Fixed crash when drawing non-textured primitives
authorSam Lantinga <slouken@libsdl.org>
Thu, 17 Feb 2011 02:16:30 -0800
changeset 5330874c671c8043
parent 5329 07317a2730ab
child 5331 16bc7591f8c8
Fixed crash when drawing non-textured primitives
src/render/opengles/SDL_render_gles.c
     1.1 --- a/src/render/opengles/SDL_render_gles.c	Wed Feb 16 20:19:02 2011 -0800
     1.2 +++ b/src/render/opengles/SDL_render_gles.c	Thu Feb 17 02:16:30 2011 -0800
     1.3 @@ -239,7 +239,7 @@
     1.4      glLoadIdentity();
     1.5  
     1.6      glEnableClientState(GL_VERTEX_ARRAY);
     1.7 -    glEnableClientState(GL_TEXTURE_COORD_ARRAY);
     1.8 +    //glEnableClientState(GL_TEXTURE_COORD_ARRAY);
     1.9      
    1.10      return renderer;
    1.11  }
    1.12 @@ -247,8 +247,6 @@
    1.13  static void
    1.14  GLES_WindowEvent(SDL_Renderer * renderer, const SDL_WindowEvent *event)
    1.15  {
    1.16 -    GLES_RenderData *data = (GLES_RenderData *) renderer->driverdata;
    1.17 -
    1.18      if (event->event == SDL_WINDOWEVENT_SIZE_CHANGED) {
    1.19          /* Rebind the context to the window area and update matrices */
    1.20          SDL_CurrentContext = NULL;
    1.21 @@ -595,13 +593,11 @@
    1.22      GLES_TextureData *texturedata = (GLES_TextureData *) texture->driverdata;
    1.23      int minx, miny, maxx, maxy;
    1.24      GLfloat minu, maxu, minv, maxv;
    1.25 -    int i;
    1.26 -    void *temp_buffer;          /* used for reformatting dirty rect pixels */
    1.27 -    void *temp_ptr;
    1.28  
    1.29      GLES_ActivateRenderer(renderer);
    1.30  
    1.31      glEnable(GL_TEXTURE_2D);
    1.32 +    glEnableClientState(GL_TEXTURE_COORD_ARRAY);
    1.33  
    1.34      glBindTexture(texturedata->type, texturedata->texture);
    1.35  
    1.36 @@ -672,7 +668,8 @@
    1.37          glTexCoordPointer(2, GL_FLOAT, 0, texCoords);
    1.38          glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
    1.39      }
    1.40 -
    1.41 +	
    1.42 +    glDisableClientState(GL_TEXTURE_COORD_ARRAY);
    1.43      glDisable(GL_TEXTURE_2D);
    1.44  
    1.45      return 0;