changeset 3446:0f969d273f65

First pass (untested) at RenderWritePixels()
author Sam Lantinga <slouken@libsdl.org>
date Wed, 18 Nov 2009 07:35:00 +0000
parents de72b49bb695
children 294b770c1989
files src/video/SDL_glfuncs.h src/video/SDL_renderer_gl.c
diffstat 2 files changed, 6 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/video/SDL_glfuncs.h	Wed Nov 18 07:34:05 2009 +0000
+++ b/src/video/SDL_glfuncs.h	Wed Nov 18 07:35:00 2009 +0000
@@ -291,7 +291,7 @@
 SDL_PROC_UNUSED(void, glRasterPos2dv, (const GLdouble * v))
 SDL_PROC_UNUSED(void, glRasterPos2f, (GLfloat x, GLfloat y))
 SDL_PROC_UNUSED(void, glRasterPos2fv, (const GLfloat * v))
-SDL_PROC_UNUSED(void, glRasterPos2i, (GLint x, GLint y))
+SDL_PROC(void, glRasterPos2i, (GLint x, GLint y))
 SDL_PROC_UNUSED(void, glRasterPos2iv, (const GLint * v))
 SDL_PROC_UNUSED(void, glRasterPos2s, (GLshort x, GLshort y))
 SDL_PROC_UNUSED(void, glRasterPos2sv, (const GLshort * v))
--- a/src/video/SDL_renderer_gl.c	Wed Nov 18 07:34:05 2009 +0000
+++ b/src/video/SDL_renderer_gl.c	Wed Nov 18 07:35:00 2009 +0000
@@ -1273,9 +1273,9 @@
     } else if (pixel_format == SDL_PIXELFORMAT_INDEX1MSB) {
         data->glPixelStorei(GL_PACK_LSB_FIRST, 0);
     }
-    //data->glPixelStorei(GL_PACK_ALIGNMENT, 1);
-    //data->glPixelStorei(GL_PACK_ROW_LENGTH,
-    //                    (pitch / bytes_per_pixel(pixel_format)));
+    data->glPixelStorei(GL_PACK_ALIGNMENT, 1);
+    data->glPixelStorei(GL_PACK_ROW_LENGTH,
+                        (pitch / bytes_per_pixel(pixel_format)));
     data->glReadBuffer(GL_FRONT);
 
 memset(pixels, 0xff, rect->h*pitch);
@@ -1325,8 +1325,8 @@
     data->glPixelStorei(GL_UNPACK_ROW_LENGTH,
                         (pitch / bytes_per_pixel(pixel_format)));
 
-    data->glReadPixels(rect->x, rect->y+rect->h-1, rect->w, rect->h,
-                       format, type, pixels);
+    data->glRasterPos2i(rect->x, rect->y);
+    data->glDrawPixels(rect->w, rect->h, format, type, pixels);
 
     return 0;
 }