comparison src/video/SDL_renderer_gl.c @ 2858:a38fcb093081

A little cleanup for SDL snapshot release
author Sam Lantinga <slouken@libsdl.org>
date Mon, 08 Dec 2008 00:24:15 +0000
parents 8a3aa505ecba
children 9dde605c7540
comparison
equal deleted inserted replaced
2857:5e04bdd79479 2858:a38fcb093081
1 /* 1 /*
2 SDL - Simple DirectMedia Layer 2 SDL - Simple DirectMedia Layer
3 Copyright (C) 1997-2006 Sam Lantinga 3 Copyright (C) 1997-2009 Sam Lantinga
4 4
5 This library is free software; you can redistribute it and/or 5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public 6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either 7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version. 8 version 2.1 of the License, or (at your option) any later version.
378 info->texture_formats[j++] = info->texture_formats[i]; 378 info->texture_formats[j++] = info->texture_formats[i];
379 } 379 }
380 } 380 }
381 --info->num_texture_formats; 381 --info->num_texture_formats;
382 } 382 }
383 /*
384 if (SDL_GL_ExtensionSupported("GL_APPLE_ycbcr_422")) { 383 if (SDL_GL_ExtensionSupported("GL_APPLE_ycbcr_422")) {
385 data->GL_APPLE_ycbcr_422_supported = SDL_TRUE; 384 data->GL_APPLE_ycbcr_422_supported = SDL_TRUE;
386 } 385 }
387 if (SDL_GL_ExtensionSupported("GL_MESA_ycbcr_texture")) { 386 if (SDL_GL_ExtensionSupported("GL_MESA_ycbcr_texture")) {
388 data->GL_MESA_ycbcr_texture_supported = SDL_TRUE; 387 data->GL_MESA_ycbcr_texture_supported = SDL_TRUE;
389 } 388 }
390 */
391 if (SDL_GL_ExtensionSupported("GL_APPLE_texture_range")) { 389 if (SDL_GL_ExtensionSupported("GL_APPLE_texture_range")) {
392 data->glTextureRangeAPPLE = 390 data->glTextureRangeAPPLE =
393 (void (*)(GLenum, GLsizei, const GLvoid *)) 391 (void (*)(GLenum, GLsizei, const GLvoid *))
394 SDL_GL_GetProcAddress("glTextureRangeAPPLE"); 392 SDL_GL_GetProcAddress("glTextureRangeAPPLE");
395 } 393 }
473 } 471 }
474 return value; 472 return value;
475 } 473 }
476 474
477 475
478 #define DEBUG_PROGRAM_COMPILE 1 476 //#define DEBUG_PROGRAM_COMPILE 1
479 477
480 static GLuint 478 static GLuint
481 compile_shader(GL_RenderData *data, GLenum shader_type, const char *_code) 479 compile_shader(GL_RenderData *data, GLenum shader_type, const char *_code)
482 { 480 {
483 const int have_texture_rects = data->GL_ARB_texture_rectangle_supported; 481 const int have_texture_rects = data->GL_ARB_texture_rectangle_supported;
853 texture_h, 0, format, type, data->pixels); 851 texture_h, 0, format, type, data->pixels);
854 } else 852 } else
855 #endif 853 #endif
856 #endif 854 #endif
857 { 855 {
858 printf("teximage2d(%d,%d)\n", (int) texture_w, (int) texture_h);
859 renderdata->glTexImage2D(data->type, 0, internalFormat, texture_w, 856 renderdata->glTexImage2D(data->type, 0, internalFormat, texture_w,
860 texture_h, 0, format, type, NULL); 857 texture_h, 0, format, type, NULL);
861 } 858 }
862 result = renderdata->glGetError(); 859 result = renderdata->glGetError();
863 if (result != GL_NO_ERROR) { 860 if (result != GL_NO_ERROR) {
997 GLenum result; 994 GLenum result;
998 995
999 renderdata->glGetError(); 996 renderdata->glGetError();
1000 SetupTextureUpdate(renderdata, texture, pitch); 997 SetupTextureUpdate(renderdata, texture, pitch);
1001 renderdata->glBindTexture(data->type, data->texture); 998 renderdata->glBindTexture(data->type, data->texture);
1002 printf("texsubimage2d(%d,%d,%d,%d)\n", (int) rect->x, (int) rect->y, (int) rect->w, (int) rect->h);
1003 renderdata->glTexSubImage2D(data->type, 0, rect->x, rect->y, rect->w, 999 renderdata->glTexSubImage2D(data->type, 0, rect->x, rect->y, rect->w,
1004 rect->h, data->format, data->formattype, 1000 rect->h, data->format, data->formattype,
1005 pixels); 1001 pixels);
1006 result = renderdata->glGetError(); 1002 result = renderdata->glGetError();
1007 if (result != GL_NO_ERROR) { 1003 if (result != GL_NO_ERROR) {
1081 for (dirty = texturedata->dirty.list; dirty; dirty = dirty->next) { 1077 for (dirty = texturedata->dirty.list; dirty; dirty = dirty->next) {
1082 SDL_Rect *rect = &dirty->rect; 1078 SDL_Rect *rect = &dirty->rect;
1083 pixels = 1079 pixels =
1084 (void *) ((Uint8 *) texturedata->pixels + rect->y * pitch + 1080 (void *) ((Uint8 *) texturedata->pixels + rect->y * pitch +
1085 rect->x * bpp); 1081 rect->x * bpp);
1086 printf("texsubimage2d(%d,%d,%d,%d)\n", (int) rect->x, (int) rect->y, (int) rect->w, (int) rect->h);
1087 data->glTexSubImage2D(texturedata->type, 0, rect->x, rect->y, 1082 data->glTexSubImage2D(texturedata->type, 0, rect->x, rect->y,
1088 rect->w / texturedata->HACK_RYAN_FIXME, rect->h, texturedata->format, 1083 rect->w / texturedata->HACK_RYAN_FIXME, rect->h, texturedata->format,
1089 texturedata->formattype, pixels); 1084 texturedata->formattype, pixels);
1090 } 1085 }
1091 SDL_ClearDirtyRects(&texturedata->dirty); 1086 SDL_ClearDirtyRects(&texturedata->dirty);