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

Fixed magenta texture on iOS with OpenGL ES 2.0

  • Loading branch information
slouken committed Jan 31, 2012
1 parent 0ce3941 commit 071211de8683e0afafa4e78adbcc80173b07acc3
Showing with 10 additions and 2 deletions.
  1. +5 −1 src/render/opengles/SDL_render_gles.c
  2. +5 −1 src/render/opengles2/SDL_render_gles2.c
@@ -111,6 +111,7 @@ typedef struct
#undef SDL_PROC
SDL_bool GL_OES_framebuffer_object_supported;
GLES_FBOList *framebuffers;
GLuint window_framebuffer;

SDL_bool useDrawTexture;
SDL_bool GL_OES_draw_texture_supported;
@@ -356,6 +357,9 @@ GLES_CreateRenderer(SDL_Window * window, Uint32 flags)
if (SDL_GL_ExtensionSupported("GL_OES_framebuffer_object")) {
data->GL_OES_framebuffer_object_supported = SDL_TRUE;
renderer->info.flags |= SDL_RENDERER_TARGETTEXTURE;

data->glGetIntegerv(GL_FRAMEBUFFER_BINDING_OES, &value);
data->window_framebuffer = (GLuint)value;
}
data->framebuffers = NULL;

@@ -586,7 +590,7 @@ GLES_SetRenderTarget(SDL_Renderer * renderer, SDL_Texture * texture)
GLES_ActivateRenderer(renderer);

if (texture == NULL) {
data->glBindFramebufferOES(GL_FRAMEBUFFER_OES, 0);
data->glBindFramebufferOES(GL_FRAMEBUFFER_OES, data->window_framebuffer);
return 0;
}

@@ -145,6 +145,7 @@ typedef struct GLES2_DriverContext
#include "SDL_gles2funcs.h"
#undef SDL_PROC
GLES2_FBOList *framebuffers;
GLuint window_framebuffer;

int shader_format_count;
GLenum *shader_formats;
@@ -546,7 +547,7 @@ GLES2_SetRenderTarget(SDL_Renderer * renderer, SDL_Texture * texture)
GLenum status;

if (texture == NULL) {
data->glBindFramebuffer(GL_FRAMEBUFFER, 0);
data->glBindFramebuffer(GL_FRAMEBUFFER, data->window_framebuffer);
} else {
texturedata = (GLES2_TextureData *) texture->driverdata;
data->glBindFramebuffer(GL_FRAMEBUFFER, texturedata->fbo->FBO);
@@ -1394,6 +1395,7 @@ GLES2_CreateRenderer(SDL_Window *window, Uint32 flags)
GLboolean hasCompiler;
#endif
Uint32 windowFlags;
GLint window_framebuffer;

SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 0);
@@ -1485,6 +1487,8 @@ GLES2_CreateRenderer(SDL_Window *window, Uint32 flags)
#endif /* ZUNE_HD */

rdata->framebuffers = NULL;
rdata->glGetIntegerv(GL_FRAMEBUFFER_BINDING, &window_framebuffer);
rdata->window_framebuffer = (GLuint)window_framebuffer;

/* Populate the function pointers for the module */
renderer->WindowEvent = &GLES2_WindowEvent;

0 comments on commit 071211d

Please sign in to comment.