comparison src/video/SDL_renderer_gl.c @ 3446:0f969d273f65

First pass (untested) at RenderWritePixels()
author Sam Lantinga <slouken@libsdl.org>
date Wed, 18 Nov 2009 07:35:00 +0000
parents 7f477a22dff5
children 294b770c1989
comparison
equal deleted inserted replaced
3445:de72b49bb695 3446:0f969d273f65
1271 if (pixel_format == SDL_PIXELFORMAT_INDEX1LSB) { 1271 if (pixel_format == SDL_PIXELFORMAT_INDEX1LSB) {
1272 data->glPixelStorei(GL_PACK_LSB_FIRST, 1); 1272 data->glPixelStorei(GL_PACK_LSB_FIRST, 1);
1273 } else if (pixel_format == SDL_PIXELFORMAT_INDEX1MSB) { 1273 } else if (pixel_format == SDL_PIXELFORMAT_INDEX1MSB) {
1274 data->glPixelStorei(GL_PACK_LSB_FIRST, 0); 1274 data->glPixelStorei(GL_PACK_LSB_FIRST, 0);
1275 } 1275 }
1276 //data->glPixelStorei(GL_PACK_ALIGNMENT, 1); 1276 data->glPixelStorei(GL_PACK_ALIGNMENT, 1);
1277 //data->glPixelStorei(GL_PACK_ROW_LENGTH, 1277 data->glPixelStorei(GL_PACK_ROW_LENGTH,
1278 // (pitch / bytes_per_pixel(pixel_format))); 1278 (pitch / bytes_per_pixel(pixel_format)));
1279 data->glReadBuffer(GL_FRONT); 1279 data->glReadBuffer(GL_FRONT);
1280 1280
1281 memset(pixels, 0xff, rect->h*pitch); 1281 memset(pixels, 0xff, rect->h*pitch);
1282 data->glReadPixels(rect->x, rect->y+rect->h-1, rect->w, rect->h, 1282 data->glReadPixels(rect->x, rect->y+rect->h-1, rect->w, rect->h,
1283 format, type, pixels); 1283 format, type, pixels);
1323 } 1323 }
1324 data->glPixelStorei(GL_UNPACK_ALIGNMENT, 1); 1324 data->glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
1325 data->glPixelStorei(GL_UNPACK_ROW_LENGTH, 1325 data->glPixelStorei(GL_UNPACK_ROW_LENGTH,
1326 (pitch / bytes_per_pixel(pixel_format))); 1326 (pitch / bytes_per_pixel(pixel_format)));
1327 1327
1328 data->glReadPixels(rect->x, rect->y+rect->h-1, rect->w, rect->h, 1328 data->glRasterPos2i(rect->x, rect->y);
1329 format, type, pixels); 1329 data->glDrawPixels(rect->w, rect->h, format, type, pixels);
1330 1330
1331 return 0; 1331 return 0;
1332 } 1332 }
1333 1333
1334 static void 1334 static void