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

Check the return value of glGenTextures()

  • Loading branch information
slouken committed Aug 10, 2013
1 parent be730de commit 2a36e610645aeb9f9e04794dbabf2262acff6d31

File 3 of 3 in 2a36e61

@@ -418,15 +418,18 @@ GLES2_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture)
/* Allocate the texture */
rdata->glGetError();
rdata->glGenTextures(1, &tdata->texture);
if (rdata->glGetError() != GL_NO_ERROR) {
SDL_free(tdata);
return SDL_SetError("Texture creation failed in glGenTextures()");
}
rdata->glActiveTexture(GL_TEXTURE0);
rdata->glBindTexture(tdata->texture_type, tdata->texture);
rdata->glTexParameteri(tdata->texture_type, GL_TEXTURE_MIN_FILTER, scaleMode);
rdata->glTexParameteri(tdata->texture_type, GL_TEXTURE_MAG_FILTER, scaleMode);
rdata->glTexParameteri(tdata->texture_type, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
rdata->glTexParameteri(tdata->texture_type, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
rdata->glTexImage2D(tdata->texture_type, 0, format, texture->w, texture->h, 0, format, type, NULL);
if (rdata->glGetError() != GL_NO_ERROR)
{
if (rdata->glGetError() != GL_NO_ERROR) {
rdata->glDeleteTextures(1, &tdata->texture);
SDL_free(tdata);
return SDL_SetError("Texture creation failed");

0 comments on commit 2a36e61

Please sign in to comment.