mirror of
https://github.com/encounter/SDL.git
synced 2025-12-20 18:29:22 +00:00
Added iOS-specific functions to get the window view's current OpenGL Renderbuffer and Framebuffer objects, so they can be more easily rebound when necessary.
This commit is contained in:
@@ -210,6 +210,40 @@ UIKit_GL_DeleteContext(_THIS, SDL_GLContext context)
|
||||
}
|
||||
}
|
||||
|
||||
Uint32 SDL_iPhoneGetViewRenderbuffer(SDL_Window * window)
|
||||
{
|
||||
if (!window) {
|
||||
SDL_SetError("Invalid window");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@autoreleasepool {
|
||||
SDL_WindowData *data = (__bridge SDL_WindowData *) window->driverdata;
|
||||
if (data.view != nil) {
|
||||
return data.view.drawableRenderbuffer;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Uint32 SDL_iPhoneGetViewFramebuffer(SDL_Window * window)
|
||||
{
|
||||
if (!window) {
|
||||
SDL_SetError("Invalid window");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@autoreleasepool {
|
||||
SDL_WindowData *data = (__bridge SDL_WindowData *) window->driverdata;
|
||||
if (data.view != nil) {
|
||||
return data.view.drawableFramebuffer;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* SDL_VIDEO_DRIVER_UIKIT */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
|
||||
@@ -50,6 +50,9 @@
|
||||
@property (nonatomic, readonly) int backingWidth;
|
||||
@property (nonatomic, readonly) int backingHeight;
|
||||
|
||||
@property (nonatomic, readonly) GLuint drawableRenderbuffer;
|
||||
@property (nonatomic, readonly) GLuint drawableFramebuffer;
|
||||
|
||||
- (void)swapBuffers;
|
||||
- (void)setCurrentContext;
|
||||
|
||||
|
||||
@@ -162,6 +162,16 @@
|
||||
return self;
|
||||
}
|
||||
|
||||
- (GLuint)drawableRenderbuffer
|
||||
{
|
||||
return viewRenderbuffer;
|
||||
}
|
||||
|
||||
- (GLuint)drawableFramebuffer
|
||||
{
|
||||
return viewFramebuffer;
|
||||
}
|
||||
|
||||
- (void)updateFrame
|
||||
{
|
||||
glBindFramebufferOES(GL_FRAMEBUFFER_OES, viewFramebuffer);
|
||||
|
||||
Reference in New Issue
Block a user