Fixed crash when drawing non-textured primitives
authorSam Lantinga <slouken@libsdl.org>
Thu, 17 Feb 2011 02:16:30 -0800
changeset 5330 874c671c8043
parent 5329 07317a2730ab
child 5331 16bc7591f8c8
Fixed crash when drawing non-textured primitives
src/render/opengles/SDL_render_gles.c
--- a/src/render/opengles/SDL_render_gles.c	Wed Feb 16 20:19:02 2011 -0800
+++ b/src/render/opengles/SDL_render_gles.c	Thu Feb 17 02:16:30 2011 -0800
@@ -239,7 +239,7 @@
     glLoadIdentity();
 
     glEnableClientState(GL_VERTEX_ARRAY);
-    glEnableClientState(GL_TEXTURE_COORD_ARRAY);
+    //glEnableClientState(GL_TEXTURE_COORD_ARRAY);
     
     return renderer;
 }
@@ -247,8 +247,6 @@
 static void
 GLES_WindowEvent(SDL_Renderer * renderer, const SDL_WindowEvent *event)
 {
-    GLES_RenderData *data = (GLES_RenderData *) renderer->driverdata;
-
     if (event->event == SDL_WINDOWEVENT_SIZE_CHANGED) {
         /* Rebind the context to the window area and update matrices */
         SDL_CurrentContext = NULL;
@@ -595,13 +593,11 @@
     GLES_TextureData *texturedata = (GLES_TextureData *) texture->driverdata;
     int minx, miny, maxx, maxy;
     GLfloat minu, maxu, minv, maxv;
-    int i;
-    void *temp_buffer;          /* used for reformatting dirty rect pixels */
-    void *temp_ptr;
 
     GLES_ActivateRenderer(renderer);
 
     glEnable(GL_TEXTURE_2D);
+    glEnableClientState(GL_TEXTURE_COORD_ARRAY);
 
     glBindTexture(texturedata->type, texturedata->texture);
 
@@ -672,7 +668,8 @@
         glTexCoordPointer(2, GL_FLOAT, 0, texCoords);
         glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
     }
-
+	
+    glDisableClientState(GL_TEXTURE_COORD_ARRAY);
     glDisable(GL_TEXTURE_2D);
 
     return 0;