mirror of https://github.com/axmolengine/axmol.git
OpenGL context attributions setting
This commit is contained in:
parent
46cdd6f8dd
commit
2a03bea1a4
|
@ -102,6 +102,8 @@ public:
|
|||
*/
|
||||
virtual void setAnimationInterval(double interval) = 0;
|
||||
|
||||
virtual bool setOGLCntattrs() { return false; }
|
||||
|
||||
/**
|
||||
@brief Get current language config
|
||||
@return Current language config
|
||||
|
|
|
@ -70,6 +70,16 @@ namespace {
|
|||
|
||||
}
|
||||
|
||||
int* GLView::_OGLCntattrs = new int[6];
|
||||
|
||||
void GLView::setOGLCntattrs(int* OGLCntattrs)
|
||||
{
|
||||
for(int i = 0; i < 6; i++)
|
||||
{
|
||||
_OGLCntattrs[i] = OGLCntattrs[i];
|
||||
}
|
||||
}
|
||||
|
||||
GLView::GLView()
|
||||
: _scaleX(1.0f)
|
||||
, _scaleY(1.0f)
|
||||
|
|
|
@ -98,6 +98,9 @@ public:
|
|||
|
||||
virtual bool windowShouldClose() { return false; };
|
||||
|
||||
static void setOGLCntattrs(int* OGLCntattrs);
|
||||
static int* _OGLCntattrs;
|
||||
|
||||
/**
|
||||
* Polls input events. Subclass must implement methods if platform
|
||||
* does not provide event callbacks.
|
||||
|
|
|
@ -30,13 +30,13 @@ THE SOFTWARE.
|
|||
#include "base/CCDirector.h"
|
||||
#include "base/ccMacros.h"
|
||||
#include "jni/IMEJni.h"
|
||||
#include "jni/JniHelper.h"
|
||||
#include "jni/Java_org_cocos2dx_lib_Cocos2dxHelper.h"
|
||||
#include "CCGL.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <android/log.h>
|
||||
|
||||
|
||||
// <EGL/egl.h> exists since android 2.3
|
||||
#include <EGL/egl.h>
|
||||
PFNGLGENVERTEXARRAYSOESPROC glGenVertexArraysOESEXT = 0;
|
||||
|
@ -73,6 +73,13 @@ GLViewImpl* GLViewImpl::create(const std::string& viewName)
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
GLViewImpl* GLViewImpl::createWithOGLCntattrs(const std::string& viewName)
|
||||
{
|
||||
activityInitWithOGLCntattrsJni(_OGLCntattrs);
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
GLViewImpl* GLViewImpl::createWithFullScreen(const std::string& viewName)
|
||||
{
|
||||
auto ret = new GLViewImpl();
|
||||
|
|
|
@ -41,6 +41,7 @@ public:
|
|||
|
||||
// static function
|
||||
static GLViewImpl* create(const std::string &viewname);
|
||||
static GLViewImpl* createWithOGLCntattrs(const std::string& viewName);
|
||||
static GLViewImpl* createWithRect(const std::string& viewName, Rect rect, float frameZoomFactor = 1.0f);
|
||||
static GLViewImpl* createWithFullScreen(const std::string& viewName);
|
||||
|
||||
|
|
|
@ -84,11 +84,15 @@ public abstract class Cocos2dxActivity extends Activity implements Cocos2dxHelpe
|
|||
|
||||
Cocos2dxHelper.init(this);
|
||||
|
||||
this.init();
|
||||
if (mVideoHelper == null) {
|
||||
mVideoHelper = new Cocos2dxVideoHelper(this, mFrameLayout);
|
||||
}
|
||||
preCreateOGLCtx();
|
||||
//this.init();
|
||||
//this.reinit();
|
||||
//if (mVideoHelper == null) {
|
||||
//mVideoHelper = new Cocos2dxVideoHelper(this, mFrameLayout);
|
||||
//}
|
||||
}
|
||||
|
||||
private static native void preCreateOGLCtx();
|
||||
|
||||
// ===========================================================
|
||||
// Getter & Setter
|
||||
|
@ -190,6 +194,49 @@ public abstract class Cocos2dxActivity extends Activity implements Cocos2dxHelpe
|
|||
// Set framelayout as the content view
|
||||
setContentView(mFrameLayout);
|
||||
}
|
||||
|
||||
public void initWithOGLCntattrs(int[] OGLCntattrs) {
|
||||
|
||||
// FrameLayout
|
||||
ViewGroup.LayoutParams framelayout_params =
|
||||
new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
|
||||
ViewGroup.LayoutParams.MATCH_PARENT);
|
||||
mFrameLayout = new FrameLayout(this);
|
||||
mFrameLayout.setLayoutParams(framelayout_params);
|
||||
|
||||
// Cocos2dxEditText layout
|
||||
ViewGroup.LayoutParams edittext_layout_params =
|
||||
new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
|
||||
ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
Cocos2dxEditText edittext = new Cocos2dxEditText(this);
|
||||
edittext.setLayoutParams(edittext_layout_params);
|
||||
|
||||
// ...add to FrameLayout
|
||||
mFrameLayout.addView(edittext);
|
||||
|
||||
// Cocos2dxGLSurfaceView
|
||||
this.mGLSurfaceView = new Cocos2dxGLSurfaceView(this);
|
||||
|
||||
//this.mGLSurfaceView.setEGLConfigChooser(5, 6, 5, 0, 16, 8);
|
||||
this.mGLSurfaceView.setEGLConfigChooser(OGLCntattrs[0], OGLCntattrs[1],OGLCntattrs[2],OGLCntattrs[3],OGLCntattrs[4],OGLCntattrs[5]);
|
||||
|
||||
// ...add to FrameLayout
|
||||
mFrameLayout.addView(this.mGLSurfaceView);
|
||||
|
||||
// Switch to supported OpenGL (ARGB888) mode on emulator
|
||||
if (isAndroidEmulator())
|
||||
this.mGLSurfaceView.setEGLConfigChooser(8 , 8, 8, 8, 16, 0);
|
||||
|
||||
this.mGLSurfaceView.setCocos2dxRenderer(new Cocos2dxRenderer());
|
||||
this.mGLSurfaceView.setCocos2dxEditText(edittext);
|
||||
|
||||
// Set framelayout as the content view
|
||||
setContentView(mFrameLayout);
|
||||
|
||||
if (mVideoHelper == null) {
|
||||
mVideoHelper = new Cocos2dxVideoHelper(this, mFrameLayout);
|
||||
}
|
||||
}
|
||||
|
||||
public Cocos2dxGLSurfaceView onCreateView() {
|
||||
return new Cocos2dxGLSurfaceView(this);
|
||||
|
|
|
@ -102,6 +102,10 @@ public class Cocos2dxHelper {
|
|||
public static Activity getActivity() {
|
||||
return sActivity;
|
||||
}
|
||||
|
||||
public static void activityInitWithOGLCntattrs(int[] OGLCntattrs){
|
||||
((Cocos2dxActivity)sActivity).initWithOGLCntattrs(OGLCntattrs);
|
||||
}
|
||||
|
||||
public static void addOnActivityResultListener(OnActivityResultListener listener) {
|
||||
onActivityResultListeners.add(listener);
|
||||
|
|
|
@ -64,7 +64,7 @@ void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit(JNIEnv* env, jobject thi
|
|||
glview->setFrameSize(w, h);
|
||||
director->setOpenGLView(glview);
|
||||
|
||||
cocos_android_app_init(env, thiz);
|
||||
//cocos_android_app_init(env, thiz);
|
||||
|
||||
cocos2d::Application::getInstance()->run();
|
||||
}
|
||||
|
@ -79,7 +79,13 @@ void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit(JNIEnv* env, jobject thi
|
|||
director->getEventDispatcher()->dispatchEvent(&recreatedEvent);
|
||||
director->setGLDefaultValues();
|
||||
}
|
||||
}
|
||||
|
||||
void Java_org_cocos2dx_lib_Cocos2dxActivity_preCreateOGLCtx(JNIEnv* env, jobject thiz)
|
||||
{
|
||||
cocos_android_app_init(env, thiz);
|
||||
cocos2d::Application::getInstance()->setOGLCntattrs();
|
||||
GLViewImpl::createWithOGLCntattrs("Android app");
|
||||
}
|
||||
|
||||
void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeOnSurfaceChanged(JNIEnv* env, jobject thiz, jint w, jint h)
|
||||
|
|
|
@ -209,6 +209,19 @@ void disableAccelerometerJni() {
|
|||
}
|
||||
}
|
||||
|
||||
void activityInitWithOGLCntattrsJni(int* OGLCntattrs) {
|
||||
JniMethodInfo t;
|
||||
|
||||
if (JniHelper::getStaticMethodInfo(t, CLASS_NAME, "activityInitWithOGLCntattrs", "([I)V")) {
|
||||
jintArray OGLCntattrsJava = t.env->NewIntArray(6);
|
||||
t.env->SetIntArrayRegion(OGLCntattrsJava, 0, 6, OGLCntattrs);
|
||||
|
||||
t.env->CallStaticVoidMethod(t.classID, t.methodID, OGLCntattrsJava);
|
||||
t.env->DeleteLocalRef(t.classID);
|
||||
CCLOG("call Cocos2dxHelper activityInitWithOGLCntattrs");
|
||||
}
|
||||
}
|
||||
|
||||
// functions for UserDefault
|
||||
bool getBoolForKeyJNI(const char* key, bool defaultValue)
|
||||
{
|
||||
|
|
|
@ -39,6 +39,7 @@ extern std::string getFileDirectoryJNI();
|
|||
extern void enableAccelerometerJni();
|
||||
extern void disableAccelerometerJni();
|
||||
extern void setAccelerometerIntervalJni(float interval);
|
||||
extern void activityInitWithOGLCntattrsJni(int* OGLCntattrs);
|
||||
// functions for UserDefault
|
||||
extern bool getBoolForKeyJNI(const char* key, bool defaultValue);
|
||||
extern int getIntegerForKeyJNI(const char* key, int defaultValue);
|
||||
|
|
|
@ -328,6 +328,15 @@ GLViewImpl* GLViewImpl::createWithFullScreen(const std::string& viewName, const
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
void GLViewImpl::convertattrs()
|
||||
{
|
||||
glfwWindowHint(GLFW_RED_BITS,_OGLCntattrs[0]);
|
||||
glfwWindowHint(GLFW_GREEN_BITS,_OGLCntattrs[1]);
|
||||
glfwWindowHint(GLFW_BLUE_BITS,_OGLCntattrs[2]);
|
||||
glfwWindowHint(GLFW_ALPHA_BITS,_OGLCntattrs[3]);
|
||||
glfwWindowHint(GLFW_DEPTH_BITS,_OGLCntattrs[4]);
|
||||
glfwWindowHint(GLFW_STENCIL_BITS,_OGLCntattrs[5]);
|
||||
}
|
||||
|
||||
bool GLViewImpl::initWithRect(const std::string& viewName, Rect rect, float frameZoomFactor)
|
||||
{
|
||||
|
@ -336,6 +345,7 @@ bool GLViewImpl::initWithRect(const std::string& viewName, Rect rect, float fram
|
|||
_frameZoomFactor = frameZoomFactor;
|
||||
|
||||
glfwWindowHint(GLFW_RESIZABLE,GL_FALSE);
|
||||
convertattrs();
|
||||
|
||||
_mainWindow = glfwCreateWindow(rect.size.width * _frameZoomFactor,
|
||||
rect.size.height * _frameZoomFactor,
|
||||
|
|
|
@ -148,6 +148,7 @@ protected:
|
|||
friend class GLFWEventHandler;
|
||||
|
||||
private:
|
||||
void convertattrs();
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(GLViewImpl);
|
||||
};
|
||||
|
||||
|
|
|
@ -52,6 +52,12 @@ public:
|
|||
|
||||
/** creates a GLViewImpl with a name in fullscreen mode */
|
||||
static GLViewImpl* createWithFullScreen(const std::string& viewName);
|
||||
|
||||
static void convert(int* _OGLCntattrs);
|
||||
static void* _pixelFormat;
|
||||
static int _depthFormat;
|
||||
|
||||
void setSize();
|
||||
|
||||
/** sets the content scale factor */
|
||||
bool setContentScaleFactor(float contentScaleFactor);
|
||||
|
|
|
@ -36,6 +36,9 @@
|
|||
|
||||
NS_CC_BEGIN
|
||||
|
||||
void* GLViewImpl::_pixelFormat = kEAGLColorFormatRGB565;
|
||||
int GLViewImpl::_depthFormat = GL_DEPTH_COMPONENT16;
|
||||
|
||||
GLViewImpl* GLViewImpl::createWithEAGLView(void *eaglview)
|
||||
{
|
||||
auto ret = new GLViewImpl;
|
||||
|
@ -80,6 +83,18 @@ GLViewImpl* GLViewImpl::createWithFullScreen(const std::string& viewName)
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
void GLViewImpl::convert(int* OGLCntattrs)
|
||||
{
|
||||
if(OGLCntattrs[0]==8 && OGLCntattrs[1]==8 && OGLCntattrs[2]==8 && OGLCntattrs[3]==8)
|
||||
{
|
||||
_pixelFormat = kEAGLColorFormatRGBA8;
|
||||
}
|
||||
if(OGLCntattrs[4]==24 && OGLCntattrs[5]==8)
|
||||
{
|
||||
_depthFormat = GL_DEPTH24_STENCIL8_OES;
|
||||
}
|
||||
}
|
||||
|
||||
GLViewImpl::GLViewImpl()
|
||||
{
|
||||
}
|
||||
|
@ -105,17 +120,19 @@ bool GLViewImpl::initWithEAGLView(void *eaglview)
|
|||
bool GLViewImpl::initWithRect(const std::string& viewName, Rect rect, float frameZoomFactor)
|
||||
{
|
||||
CGRect r = CGRectMake(rect.origin.x, rect.origin.y, rect.size.width, rect.size.height);
|
||||
convert(_OGLCntattrs);
|
||||
CCEAGLView *eaglview = [CCEAGLView viewWithFrame: r
|
||||
pixelFormat: kEAGLColorFormatRGB565
|
||||
depthFormat: GL_DEPTH24_STENCIL8_OES
|
||||
pixelFormat: (NSString*)_pixelFormat
|
||||
depthFormat: _depthFormat
|
||||
preserveBackbuffer: NO
|
||||
sharegroup: nil
|
||||
multiSampling: NO
|
||||
numberOfSamples: 0];
|
||||
|
||||
[eaglview setMultipleTouchEnabled:YES];
|
||||
|
||||
_screenSize.width = _designResolutionSize.width = [eaglview getWidth];
|
||||
_screenSize.height = _designResolutionSize.height = [eaglview getHeight];
|
||||
//_screenSize.width = _designResolutionSize.width = [eaglview getWidth];
|
||||
//_screenSize.height = _designResolutionSize.height = [eaglview getHeight];
|
||||
// _scaleX = _scaleY = [eaglview contentScaleFactor];
|
||||
|
||||
_eaglview = eaglview;
|
||||
|
@ -123,6 +140,13 @@ bool GLViewImpl::initWithRect(const std::string& viewName, Rect rect, float fram
|
|||
return true;
|
||||
}
|
||||
|
||||
void GLViewImpl::setSize()
|
||||
{
|
||||
CCEAGLView *eaglview = (CCEAGLView*) _eaglview;
|
||||
_screenSize.width = _designResolutionSize.width = [eaglview getWidth];
|
||||
_screenSize.height = _designResolutionSize.height = [eaglview getHeight];
|
||||
}
|
||||
|
||||
bool GLViewImpl::initWithFullScreen(const std::string& viewName)
|
||||
{
|
||||
CGRect rect = [[UIScreen mainScreen] bounds];
|
||||
|
|
|
@ -63,6 +63,7 @@ Application::~Application()
|
|||
|
||||
int Application::run()
|
||||
{
|
||||
setOGLCntattrs();
|
||||
// Initialize instance and cocos2d.
|
||||
if (! applicationDidFinishLaunching())
|
||||
{
|
||||
|
|
|
@ -64,6 +64,7 @@ Application::~Application()
|
|||
|
||||
int Application::run()
|
||||
{
|
||||
setOGLCntattrs();
|
||||
if(!applicationDidFinishLaunching())
|
||||
{
|
||||
return 1;
|
||||
|
|
|
@ -69,6 +69,8 @@ int Application::run()
|
|||
QueryPerformanceFrequency(&nFreq);
|
||||
QueryPerformanceCounter(&nLast);
|
||||
|
||||
setOGLCntattrs();
|
||||
|
||||
// Initialize instance and cocos2d.
|
||||
if (!applicationDidFinishLaunching())
|
||||
{
|
||||
|
|
|
@ -17,6 +17,15 @@ AppDelegate::~AppDelegate()
|
|||
{
|
||||
}
|
||||
|
||||
bool AppDelegate::setOGLCntattrs()
|
||||
{
|
||||
int OGLCntattrs[] = {8, 8, 8, 8, 24, 8};
|
||||
|
||||
GLView::setOGLCntattrs(OGLCntattrs);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AppDelegate::applicationDidFinishLaunching() {
|
||||
// initialize director
|
||||
auto director = Director::getInstance();
|
||||
|
|
|
@ -14,6 +14,8 @@ public:
|
|||
AppDelegate();
|
||||
virtual ~AppDelegate();
|
||||
|
||||
virtual bool setOGLCntattrs();
|
||||
|
||||
/**
|
||||
@brief Implement Director and Scene init code here.
|
||||
@return true Initialize success, app continue.
|
||||
|
|
|
@ -38,19 +38,25 @@ static AppDelegate s_sharedApplication;
|
|||
|
||||
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
|
||||
|
||||
cocos2d::Application *app = cocos2d::Application::getInstance();
|
||||
app->setOGLCntattrs();
|
||||
|
||||
// Override point for customization after application launch.
|
||||
|
||||
// Add the view controller's view to the window and display.
|
||||
window = [[UIWindow alloc] initWithFrame: [[UIScreen mainScreen] bounds]];
|
||||
CCEAGLView *eaglView = [CCEAGLView viewWithFrame: [window bounds]
|
||||
auto glview = cocos2d::GLViewImpl::createWithFullScreen("ios cpp-empty-test");
|
||||
CCEAGLView *eaglView = (CCEAGLView*)glview->getEAGLView();
|
||||
/*CCEAGLView eaglView = [CCEAGLView viewWithFrame: [window bounds]
|
||||
pixelFormat: kEAGLColorFormatRGBA8
|
||||
depthFormat: GL_DEPTH_COMPONENT16
|
||||
preserveBackbuffer: NO
|
||||
sharegroup:nil
|
||||
multiSampling:NO
|
||||
numberOfSamples:0];
|
||||
sharegroup: nil
|
||||
multiSampling: NO
|
||||
numberOfSamples: 0];*/
|
||||
|
||||
// Use RootViewController manage CCEAGLView
|
||||
|
||||
// Use RootViewController manage CCEAGLView
|
||||
viewController = [[RootViewController alloc] initWithNibName:nil bundle:nil];
|
||||
viewController.wantsFullScreenLayout = YES;
|
||||
viewController.view = eaglView;
|
||||
|
@ -71,11 +77,12 @@ static AppDelegate s_sharedApplication;
|
|||
|
||||
[[UIApplication sharedApplication] setStatusBarHidden: YES];
|
||||
|
||||
glview->setSize();
|
||||
// IMPORTANT: Setting the GLView should be done after creating the RootViewController
|
||||
cocos2d::GLViewImpl *glview = cocos2d::GLViewImpl::createWithEAGLView(eaglView);
|
||||
//cocos2d::GLViewImpl *glview = cocos2d::GLViewImpl::createWithEAGLView(eaglView);
|
||||
cocos2d::Director::getInstance()->setOpenGLView(glview);
|
||||
|
||||
cocos2d::Application *app = cocos2d::Application::getInstance();
|
||||
//cocos2d::Application *app = cocos2d::Application::getInstance();
|
||||
app->run();
|
||||
return YES;
|
||||
}
|
||||
|
|
|
@ -43,6 +43,17 @@ AppDelegate::~AppDelegate()
|
|||
cocostudio::ArmatureDataManager::destroyInstance();
|
||||
}
|
||||
|
||||
bool AppDelegate::setOGLCntattrs()
|
||||
{
|
||||
//set OpenGL context attributions
|
||||
//red,green,blue,alpha,depth,stencil
|
||||
int OGLCntattrs[] = {8, 8, 8, 8, 24, 8};
|
||||
|
||||
GLView::setOGLCntattrs(OGLCntattrs);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AppDelegate::applicationDidFinishLaunching()
|
||||
{
|
||||
// As an example, load config file
|
||||
|
|
|
@ -39,6 +39,8 @@ public:
|
|||
AppDelegate();
|
||||
virtual ~AppDelegate();
|
||||
|
||||
virtual bool setOGLCntattrs();
|
||||
|
||||
/**
|
||||
@brief Implement Director and Scene init code here.
|
||||
@return true Initialize success, app continue.
|
||||
|
|
|
@ -42,20 +42,23 @@ static AppDelegate s_sharedApplication;
|
|||
{
|
||||
|
||||
cocos2d::Application *app = cocos2d::Application::getInstance();
|
||||
app->setOGLCntattrs();
|
||||
|
||||
// Override point for customization after application launch.
|
||||
|
||||
// Add the view controller's view to the window and display.
|
||||
window = [[UIWindow alloc] initWithFrame: [[UIScreen mainScreen] bounds]];
|
||||
|
||||
|
||||
// Init the CCEAGLView
|
||||
CCEAGLView *eaglView = [CCEAGLView viewWithFrame: [window bounds]
|
||||
auto glview = cocos2d::GLViewImpl::createWithFullScreen("ios cpp-tests");
|
||||
CCEAGLView *eaglView = (CCEAGLView*)glview->getEAGLView();
|
||||
/*CCEAGLView *eaglView = [CCEAGLView viewWithFrame: [window bounds]
|
||||
pixelFormat: kEAGLColorFormatRGBA8
|
||||
depthFormat: GL_DEPTH24_STENCIL8_OES
|
||||
preserveBackbuffer: NO
|
||||
sharegroup: nil
|
||||
multiSampling: NO
|
||||
numberOfSamples: 0 ];
|
||||
numberOfSamples: 0 ];*/
|
||||
|
||||
[eaglView setMultipleTouchEnabled:YES];
|
||||
|
||||
|
@ -79,9 +82,11 @@ static AppDelegate s_sharedApplication;
|
|||
[window makeKeyAndVisible];
|
||||
|
||||
[[UIApplication sharedApplication] setStatusBarHidden:true];
|
||||
|
||||
|
||||
glview->setSize();
|
||||
|
||||
// IMPORTANT: Setting the GLView should be done after creating the RootViewController
|
||||
cocos2d::GLView *glview = cocos2d::GLViewImpl::createWithEAGLView(eaglView);
|
||||
//cocos2d::GLView *glview = cocos2d::GLViewImpl::createWithEAGLView(eaglView);
|
||||
cocos2d::Director::getInstance()->setOpenGLView(glview);
|
||||
|
||||
app->run();
|
||||
|
|
|
@ -21,6 +21,15 @@ AppDelegate::~AppDelegate()
|
|||
//CCScriptEngineManager::destroyInstance();
|
||||
}
|
||||
|
||||
bool AppDelegate::setOGLCntattrs()
|
||||
{
|
||||
int OGLCntattrs[] = {8, 8, 8, 8, 24, 8};
|
||||
|
||||
GLView::setOGLCntattrs(OGLCntattrs);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AppDelegate::applicationDidFinishLaunching()
|
||||
{
|
||||
// register lua engine
|
||||
|
|
|
@ -14,6 +14,7 @@ public:
|
|||
AppDelegate();
|
||||
virtual ~AppDelegate();
|
||||
|
||||
virtual bool setOGLCntattrs();
|
||||
/**
|
||||
@brief Implement Director and Scene init code here.
|
||||
@return true Initialize success, app continue.
|
||||
|
|
|
@ -18,6 +18,15 @@ AppDelegate::~AppDelegate()
|
|||
SimpleAudioEngine::end();
|
||||
}
|
||||
|
||||
bool AppDelegate::setOGLCntattrs()
|
||||
{
|
||||
int OGLCntattrs[] = {8, 8, 8, 8, 24, 8};
|
||||
|
||||
GLView::setOGLCntattrs(OGLCntattrs);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AppDelegate::applicationDidFinishLaunching()
|
||||
{
|
||||
// register lua engine
|
||||
|
|
|
@ -14,6 +14,7 @@ public:
|
|||
AppDelegate();
|
||||
virtual ~AppDelegate();
|
||||
|
||||
bool setOGLCntattrs();
|
||||
/**
|
||||
@brief Implement Director and Scene init code here.
|
||||
@return true Initialize success, app continue.
|
||||
|
|
Loading…
Reference in New Issue