First pass (untested) at RenderWritePixels()
authorSam Lantinga
Wed, 18 Nov 2009 07:35:00 +0000
changeset 34460f969d273f65
parent 3445 de72b49bb695
child 3447 294b770c1989
First pass (untested) at RenderWritePixels()
src/video/SDL_glfuncs.h
src/video/SDL_renderer_gl.c
     1.1 --- a/src/video/SDL_glfuncs.h	Wed Nov 18 07:34:05 2009 +0000
     1.2 +++ b/src/video/SDL_glfuncs.h	Wed Nov 18 07:35:00 2009 +0000
     1.3 @@ -291,7 +291,7 @@
     1.4  SDL_PROC_UNUSED(void, glRasterPos2dv, (const GLdouble * v))
     1.5  SDL_PROC_UNUSED(void, glRasterPos2f, (GLfloat x, GLfloat y))
     1.6  SDL_PROC_UNUSED(void, glRasterPos2fv, (const GLfloat * v))
     1.7 -SDL_PROC_UNUSED(void, glRasterPos2i, (GLint x, GLint y))
     1.8 +SDL_PROC(void, glRasterPos2i, (GLint x, GLint y))
     1.9  SDL_PROC_UNUSED(void, glRasterPos2iv, (const GLint * v))
    1.10  SDL_PROC_UNUSED(void, glRasterPos2s, (GLshort x, GLshort y))
    1.11  SDL_PROC_UNUSED(void, glRasterPos2sv, (const GLshort * v))
     2.1 --- a/src/video/SDL_renderer_gl.c	Wed Nov 18 07:34:05 2009 +0000
     2.2 +++ b/src/video/SDL_renderer_gl.c	Wed Nov 18 07:35:00 2009 +0000
     2.3 @@ -1273,9 +1273,9 @@
     2.4      } else if (pixel_format == SDL_PIXELFORMAT_INDEX1MSB) {
     2.5          data->glPixelStorei(GL_PACK_LSB_FIRST, 0);
     2.6      }
     2.7 -    //data->glPixelStorei(GL_PACK_ALIGNMENT, 1);
     2.8 -    //data->glPixelStorei(GL_PACK_ROW_LENGTH,
     2.9 -    //                    (pitch / bytes_per_pixel(pixel_format)));
    2.10 +    data->glPixelStorei(GL_PACK_ALIGNMENT, 1);
    2.11 +    data->glPixelStorei(GL_PACK_ROW_LENGTH,
    2.12 +                        (pitch / bytes_per_pixel(pixel_format)));
    2.13      data->glReadBuffer(GL_FRONT);
    2.14  
    2.15  memset(pixels, 0xff, rect->h*pitch);
    2.16 @@ -1325,8 +1325,8 @@
    2.17      data->glPixelStorei(GL_UNPACK_ROW_LENGTH,
    2.18                          (pitch / bytes_per_pixel(pixel_format)));
    2.19  
    2.20 -    data->glReadPixels(rect->x, rect->y+rect->h-1, rect->w, rect->h,
    2.21 -                       format, type, pixels);
    2.22 +    data->glRasterPos2i(rect->x, rect->y);
    2.23 +    data->glDrawPixels(rect->w, rect->h, format, type, pixels);
    2.24  
    2.25      return 0;
    2.26  }