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];
GLenum GLenum GLenum GLenum GLenum scale
SDL_bool UIKit_IsSystemVersionAtLeast(double version)
void UIKit_GL_DeleteContext(_THIS, SDL_GLContext context)
GLfloat GLfloat GLfloat GLfloat h
SDL_uikitviewcontroller * viewcontroller
void UIKit_GL_GetDrawableSize(_THIS, SDL_Window *window, int *w, int *h)
static screen_context_t context
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
int UIKit_GL_LoadLibrary(_THIS, const char *path)
void UIKit_GL_RestoreCurrentContext(void)
int UIKit_GL_SwapWindow(_THIS, SDL_Window *window)
static SDL_VideoDevice * _this
void * SDL_GLContext
An opaque handle to an OpenGL context.
GLubyte GLubyte GLubyte GLubyte w
SDL_GLContext UIKit_GL_CreateContext(_THIS, SDL_Window *window)
int share_with_current_context
void * UIKit_GL_GetProcAddress(_THIS, const char *proc)
#define SDL_GL_GetCurrentContext
EGLSurface EGLNativeWindowType * window
SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char const char SDL_SCANF_FORMAT_STRING const char return SDL_ThreadFunction const char void return Uint32 return Uint32 void
The type used to identify a window.
GLsizei const GLchar *const * path
struct SDL_VideoDevice::@34 gl_config
int UIKit_GL_MakeCurrent(_THIS, SDL_Window *window, SDL_GLContext context)