Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Trying to figure out why the OpenGL tests are failing...
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Nov 18, 2009
1 parent ee74013 commit 58629b5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/video/SDL_glfuncs.h
Expand Up @@ -314,7 +314,7 @@ SDL_PROC_UNUSED(void, glRasterPos4iv, (const GLint * v))
SDL_PROC_UNUSED(void, glRasterPos4s,
(GLshort x, GLshort y, GLshort z, GLshort w))
SDL_PROC_UNUSED(void, glRasterPos4sv, (const GLshort * v))
SDL_PROC_UNUSED(void, glReadBuffer, (GLenum mode))
SDL_PROC(void, glReadBuffer, (GLenum mode))
SDL_PROC(void, glReadPixels,
(GLint x, GLint y, GLsizei width, GLsizei height,
GLenum format, GLenum type, GLvoid * pixels))
Expand Down
10 changes: 7 additions & 3 deletions src/video/SDL_renderer_gl.c
Expand Up @@ -1273,13 +1273,16 @@ GL_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect,
} 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);
data->glReadPixels(rect->x, rect->y+rect->h-1, rect->w, rect->h,
format, type, pixels);

#if 0
/* Flip the rows to be top-down */
length = rect->w * bytes_per_pixel(pixel_format);
src = (Uint8*)pixels + (rect->h-1)*pitch;
Expand All @@ -1292,6 +1295,7 @@ GL_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect,
SDL_memcpy(src, tmp, length);
}
SDL_stack_free(tmp);
#endif

return 0;
}
Expand Down

0 comments on commit 58629b5

Please sign in to comment.