Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Implement SDL_GL_SHARE_WITH_CURRENT_CONTEXT for iOS.

Fixes Bugzilla #1947.
  • Loading branch information
icculus committed Jul 13, 2013
1 parent 4a05d4c commit 77b3a8c64fe2647708edf0fec43e2b374b2e84e1
@@ -104,6 +104,11 @@ SDL_GLContext UIKit_GL_CreateContext(_THIS, SDL_Window * window)
SDL_DisplayData *displaydata = display->driverdata;
SDL_DisplayModeData *displaymodedata = display->current_mode.driverdata;
UIWindow *uiwindow = data->uiwindow;
EAGLSharegroup *share_group = nil;

if (_this->gl_config.share_with_current_context) {
share_group = [((SDL_uikitopenglview *) SDL_GL_GetCurrentContext() sharegroup];
}

/* construct our view, passing in SDL's OpenGL configuration data */
CGRect frame;
@@ -121,7 +126,8 @@ SDL_GLContext UIKit_GL_CreateContext(_THIS, SDL_Window * window)
aBits: _this->gl_config.alpha_size
depthBits: _this->gl_config.depth_size
stencilBits: _this->gl_config.stencil_size
majorVersion: _this->gl_config.major_version];
majorVersion: _this->gl_config.major_version
shareGroup: share_group];
if (!view) {
return NULL;
}
@@ -67,7 +67,8 @@
aBits:(int)aBits
depthBits:(int)depthBits
stencilBits:(int)stencilBits
majorVersion:(int)majorVersion;
majorVersion:(int)majorVersion
shareGroup:(EAGLSharegroup*)shareGroup;

- (void)updateFrame;

@@ -47,6 +47,7 @@ - (id)initWithFrame:(CGRect)frame
depthBits:(int)depthBits
stencilBits:(int)stencilBits
majorVersion:(int)majorVersion
shareGroup:(EAGLSharegroup*)shareGroup
{
depthBufferFormat = 0;

@@ -71,9 +72,9 @@ - (id)initWithFrame:(CGRect)frame
[NSNumber numberWithBool: retained], kEAGLDrawablePropertyRetainedBacking, colorFormat, kEAGLDrawablePropertyColorFormat, nil];

if (majorVersion > 1) {
context = [[EAGLContext alloc] initWithAPI: kEAGLRenderingAPIOpenGLES2];
context = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2 sharegroup:shareGroup];
} else {
context = [[EAGLContext alloc] initWithAPI: kEAGLRenderingAPIOpenGLES1];
context = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES1 sharegroup:shareGroup];
}
if (!context || ![EAGLContext setCurrentContext:context]) {
[self release];

0 comments on commit 77b3a8c

Please sign in to comment.