21 #include "../../SDL_internal.h"
23 #if SDL_VIDEO_DRIVER_UIKIT
30 #include "../SDL_sysvideo.h"
31 #include "../../events/SDL_keyboard_c.h"
32 #include "../../events/SDL_mouse_c.h"
33 #include "../../power/uikit/SDL_syspower.h"
37 @interface SDLEAGLContext : EAGLContext
44 @implementation SDLEAGLContext
50 [
self.sdlView setSDLWindow:NULL];
61 return dlsym(RTLD_DEFAULT, proc);
71 SDLEAGLContext *eaglcontext = (__bridge SDLEAGLContext *) context;
73 if (![EAGLContext setCurrentContext:eaglcontext]) {
74 return SDL_SetError(
"Could not make EAGL context current");
78 [eaglcontext.sdlView setSDLWindow:window];
92 SDL_uikitopenglview *glview = (SDL_uikitopenglview *) view;
109 return SDL_SetError(
"iOS GL Load Library just here for compatibility");
121 SDL_UIKit_UpdateBatteryMonitoring();
124 [context.sdlView swapBuffers];
137 SDLEAGLContext *context = nil;
138 SDL_uikitopenglview *view;
140 CGRect
frame = UIKit_ComputeViewFrame(window, data.
uiwindow.screen);
141 EAGLSharegroup *sharegroup = nil;
149 EAGLRenderingAPI api = major;
154 SDL_SetError(
"OpenGL ES %d.%d context could not be created", major, minor);
164 sharegroup = context.sharegroup;
172 if ([data.
uiwindow.screen respondsToSelector:
@selector(nativeScale)]) {
173 scale = data.
uiwindow.screen.nativeScale;
181 context = [[SDLEAGLContext alloc] initWithAPI:api sharegroup:sharegroup];
190 retainBacking:_this->gl_config.retained_backing
191 rBits:_this->gl_config.red_size
192 gBits:_this->gl_config.green_size
193 bBits:_this->gl_config.blue_size
194 aBits:_this->gl_config.alpha_size
195 depthBits:_this->gl_config.depth_size
196 stencilBits:_this->gl_config.stencil_size
197 sRGB:_this->gl_config.framebuffer_srgb_capable
206 context.sdlView = view;
215 return (SDL_GLContext) CFBridgingRetain(context);
242 if (context !=
NULL && [EAGLContext currentContext] != context) {
243 [EAGLContext setCurrentContext:context];