src/render/opengl/SDL_render_gl.c
changeset 5397 88ff1f463134
parent 5381 79e60256dbf7
child 5402 5d102cd8aef3
     1.1 --- a/src/render/opengl/SDL_render_gl.c	Thu Feb 24 18:11:29 2011 -0800
     1.2 +++ b/src/render/opengl/SDL_render_gl.c	Thu Feb 24 23:42:58 2011 -0800
     1.3 @@ -99,9 +99,6 @@
     1.4  #include "SDL_glfuncs.h"
     1.5  #undef SDL_PROC
     1.6  
     1.7 -    void (*glTextureRangeAPPLE) (GLenum target, GLsizei length,
     1.8 -                                 const GLvoid * pointer);
     1.9 -
    1.10      /* Multitexture support */
    1.11      SDL_bool GL_ARB_multitexture_supported;
    1.12      PFNGLACTIVETEXTUREARBPROC glActiveTextureARB;
    1.13 @@ -322,11 +319,6 @@
    1.14          || SDL_GL_ExtensionSupported("GL_EXT_texture_rectangle")) {
    1.15          data->GL_ARB_texture_rectangle_supported = SDL_TRUE;
    1.16      }
    1.17 -    if (SDL_GL_ExtensionSupported("GL_APPLE_texture_range")) {
    1.18 -        data->glTextureRangeAPPLE =
    1.19 -            (void (*)(GLenum, GLsizei, const GLvoid *))
    1.20 -            SDL_GL_GetProcAddress("glTextureRangeAPPLE");
    1.21 -    }
    1.22  
    1.23      /* Check for multitexture support */
    1.24      if (SDL_GL_ExtensionSupported("GL_ARB_multitexture")) {
    1.25 @@ -488,10 +480,15 @@
    1.26                                      GL_STORAGE_CACHED_APPLE);
    1.27      }
    1.28      if (texture->access == SDL_TEXTUREACCESS_STREAMING
    1.29 -        && texture->format == SDL_PIXELFORMAT_ARGB8888) {
    1.30 +        && texture->format == SDL_PIXELFORMAT_ARGB8888
    1.31 +        && (texture->w % 8) == 0) {
    1.32          renderdata->glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_TRUE);
    1.33 +        renderdata->glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
    1.34 +        renderdata->glPixelStorei(GL_UNPACK_ROW_LENGTH,
    1.35 +                          (data->pitch / SDL_BYTESPERPIXEL(texture->format)));
    1.36          renderdata->glTexImage2D(data->type, 0, internalFormat, texture_w,
    1.37                                   texture_h, 0, format, type, data->pixels);
    1.38 +        renderdata->glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_FALSE);
    1.39      }
    1.40      else
    1.41  #endif
    1.42 @@ -546,11 +543,11 @@
    1.43      GL_ActivateRenderer(renderer);
    1.44  
    1.45      renderdata->glGetError();
    1.46 +    renderdata->glEnable(data->type);
    1.47 +    renderdata->glBindTexture(data->type, data->texture);
    1.48      renderdata->glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
    1.49      renderdata->glPixelStorei(GL_UNPACK_ROW_LENGTH,
    1.50                                (pitch / SDL_BYTESPERPIXEL(texture->format)));
    1.51 -    renderdata->glEnable(data->type);
    1.52 -    renderdata->glBindTexture(data->type, data->texture);
    1.53      renderdata->glTexSubImage2D(data->type, 0, rect->x, rect->y, rect->w,
    1.54                                  rect->h, data->format, data->formattype,
    1.55                                  pixels);