diff src/render/opengles/SDL_render_gles.c @ 5204:523409574510

Added an OpenGL ES 2.0 renderer, contributed by itsnotabigtruck This compiles, but it untested.
author Sam Lantinga <slouken@libsdl.org>
date Sun, 06 Feb 2011 00:00:13 -0800
parents bb45ecd958d8
children 25ffd4e5255c
line wrap: on
line diff
--- a/src/render/opengles/SDL_render_gles.c	Sat Feb 05 20:02:37 2011 -0800
+++ b/src/render/opengles/SDL_render_gles.c	Sun Feb 06 00:00:13 2011 -0800
@@ -71,7 +71,7 @@
 static void GLES_DestroyRenderer(SDL_Renderer * renderer);
 
 
-SDL_RenderDriver GL_ES_RenderDriver = {
+SDL_RenderDriver GLES_RenderDriver = {
     GLES_CreateRenderer,
     {
      "opengl_es",
@@ -201,7 +201,7 @@
     renderer->RenderPresent = GLES_RenderPresent;
     renderer->DestroyTexture = GLES_DestroyTexture;
     renderer->DestroyRenderer = GLES_DestroyRenderer;
-    renderer->info = GL_ES_RenderDriver.info;
+    renderer->info = GLES_RenderDriver.info;
     renderer->driverdata = data;
 
     renderer->info.flags = SDL_RENDERER_ACCELERATED;
@@ -265,7 +265,6 @@
 static int
 GLES_ActivateRenderer(SDL_Renderer * renderer)
 {
-
     GLES_RenderData *data = (GLES_RenderData *) renderer->driverdata;
     SDL_Window *window = renderer->window;
 
@@ -390,13 +389,6 @@
     return 0;
 }
 
-static void
-SetupTextureUpdate(GLES_RenderData * renderdata, SDL_Texture * texture,
-                   int pitch)
-{
-    renderdata->glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
-}
-
 static int
 GLES_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
                    const SDL_Rect * rect, const void *pixels, int pitch)
@@ -412,7 +404,7 @@
     GLES_ActivateRenderer(renderer);
 
     renderdata->glGetError();
-    SetupTextureUpdate(renderdata, texture, pitch);
+    renderdata->glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
     renderdata->glEnable(data->type);
     renderdata->glBindTexture(data->type, data->texture);
 
@@ -467,7 +459,7 @@
 
     GLES_ActivateRenderer(renderer);
 
-    SetupTextureUpdate(renderdata, texture, data->pitch);
+    renderdata->glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
     renderdata->glEnable(data->type);
     renderdata->glBindTexture(data->type, data->texture);
     renderdata->glTexSubImage2D(data->type, 0, 0, 0, texture->w,