Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Fixed crash when drawing non-textured primitives
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Feb 17, 2011
1 parent ea710d3 commit 7cd4f75
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions src/render/opengles/SDL_render_gles.c
Expand Up @@ -239,16 +239,14 @@ GLES_CreateRenderer(SDL_Window * window, Uint32 flags)
glLoadIdentity();

glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
//glEnableClientState(GL_TEXTURE_COORD_ARRAY);

return renderer;
}

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;
Expand Down Expand Up @@ -595,13 +593,11 @@ GLES_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture,
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);

Expand Down Expand Up @@ -672,7 +668,8 @@ GLES_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture,
glTexCoordPointer(2, GL_FLOAT, 0, texCoords);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
}


glDisableClientState(GL_TEXTURE_COORD_ARRAY);
glDisable(GL_TEXTURE_2D);

return 0;
Expand Down

0 comments on commit 7cd4f75

Please sign in to comment.