osx: Fixed bug with creating context twice.
We should assign context and pixel_format vars to null to avoid multiple context creation.
This commit is contained in:
parent
50793eac51
commit
8c69a639cb
@ -80,31 +80,32 @@ clutter_backend_osx_create_context (ClutterBackend *backend,
|
|||||||
{
|
{
|
||||||
ClutterBackendOSX *backend_osx = CLUTTER_BACKEND_OSX (backend);
|
ClutterBackendOSX *backend_osx = CLUTTER_BACKEND_OSX (backend);
|
||||||
CLUTTER_OSX_POOL_ALLOC();
|
CLUTTER_OSX_POOL_ALLOC();
|
||||||
|
if ( backend_osx->context == nil)
|
||||||
|
{
|
||||||
|
/* Allocate ourselves a GL context. Since we're supposed to have only one per
|
||||||
|
* backend we can just as well create it now.
|
||||||
|
*/
|
||||||
|
NSOpenGLPixelFormatAttribute attrs[] = {
|
||||||
|
NSOpenGLPFADoubleBuffer,
|
||||||
|
NSOpenGLPFADepthSize, 24,
|
||||||
|
NSOpenGLPFAStencilSize, 8,
|
||||||
|
0
|
||||||
|
};
|
||||||
|
|
||||||
/* Allocate ourselves a GL context. Since we're supposed to have only one per
|
backend_osx->pixel_format = [[NSOpenGLPixelFormat alloc] initWithAttributes:attrs];
|
||||||
* backend we can just as well create it now.
|
backend_osx->context = [[NSOpenGLContext alloc]
|
||||||
*/
|
initWithFormat: backend_osx->pixel_format
|
||||||
NSOpenGLPixelFormatAttribute attrs[] = {
|
shareContext: nil];
|
||||||
NSOpenGLPFADoubleBuffer,
|
/* Enable vblank sync - http://developer.apple.com/qa/qa2007/qa1521.html */
|
||||||
NSOpenGLPFADepthSize, 24,
|
#ifdef MAC_OS_X_VERSION_10_5
|
||||||
NSOpenGLPFAStencilSize, 8,
|
const int sw = 1;
|
||||||
0
|
#else
|
||||||
};
|
const long sw = 1;
|
||||||
|
#endif
|
||||||
backend_osx->pixel_format = [[NSOpenGLPixelFormat alloc] initWithAttributes:attrs];
|
[backend_osx->context setValues:&sw forParameter: NSOpenGLCPSwapInterval];
|
||||||
backend_osx->context = [[NSOpenGLContext alloc]
|
}
|
||||||
initWithFormat: backend_osx->pixel_format
|
|
||||||
shareContext: nil];
|
|
||||||
/* Enable vblank sync - http://developer.apple.com/qa/qa2007/qa1521.html */
|
|
||||||
#ifdef MAC_OS_X_VERSION_10_5
|
|
||||||
const int sw = 1;
|
|
||||||
#else
|
|
||||||
const long sw = 1;
|
|
||||||
#endif
|
|
||||||
[backend_osx->context setValues:&sw forParameter: NSOpenGLCPSwapInterval];
|
|
||||||
[backend_osx->context makeCurrentContext];
|
[backend_osx->context makeCurrentContext];
|
||||||
CLUTTER_NOTE (BACKEND, "Context was created");
|
CLUTTER_NOTE (BACKEND, "Context was created");
|
||||||
|
|
||||||
CLUTTER_OSX_POOL_RELEASE();
|
CLUTTER_OSX_POOL_RELEASE();
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -156,8 +157,10 @@ clutter_backend_osx_redraw (ClutterBackend *backend, ClutterStage *wrapper)
|
|||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
|
|
||||||
static void
|
static void
|
||||||
clutter_backend_osx_init (ClutterBackendOSX *self)
|
clutter_backend_osx_init (ClutterBackendOSX *backend_osx)
|
||||||
{
|
{
|
||||||
|
backend_osx->context = nil;
|
||||||
|
backend_osx->pixel_format = nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
Loading…
Reference in New Issue
Block a user