comparison src/video/SDL_renderer_gles.c @ 3165:7168651d5706

QNX quirk has been added, QNX OpenGL ES implementation is broken regarding support of textures with packed pixel formats.
author Mike Gorchak <lestat@i.com.ua>
date Fri, 05 Jun 2009 07:30:51 +0000
parents a252014ce27d
children f294338ca6eb
comparison
equal deleted inserted replaced
3164:c5b2884c26b4 3165:7168651d5706
28 #include "SDL_sysvideo.h" 28 #include "SDL_sysvideo.h"
29 #include "SDL_pixels_c.h" 29 #include "SDL_pixels_c.h"
30 #include "SDL_rect_c.h" 30 #include "SDL_rect_c.h"
31 #include "SDL_yuv_sw_c.h" 31 #include "SDL_yuv_sw_c.h"
32 32
33 #if defined(SDL_VIDEO_DRIVER_QNXGF) || defined(SDL_VIDEO_DRIVER_PHOTON) 33 #if defined(__QNXNTO__)
34 34 /* Include QNX system header to check QNX version later */
35 /* Empty function stub to get OpenGL ES 1.0 support without */ 35 #include <sys/neutrino.h>
36 /* OpenGL ES extension GL_OES_draw_texture_supported */ 36 #endif /* __QNXNTO__ */
37
38 #if defined(SDL_VIDEO_DRIVER_QNXGF) || \
39 defined(SDL_VIDEO_DRIVER_PHOTON) || \
40 defined(SDL_VIDEO_DRIVER_PANDORA)
41
42 /* Empty function stub to get OpenGL ES 1.x support without */
43 /* OpenGL ES extension GL_OES_draw_texture supported */
37 GL_API void GL_APIENTRY 44 GL_API void GL_APIENTRY
38 glDrawTexiOES(GLint x, GLint y, GLint z, GLint width, GLint height) 45 glDrawTexiOES(GLint x, GLint y, GLint z, GLint width, GLint height)
39 { 46 {
40 return; 47 return;
41 } 48 }
42 49
43 #endif /* __QNXNTO__ */ 50 #endif /* QNXGF || PHOTON || PANDORA */
44
45 #if SDL_VIDEO_DRIVER_PANDORA
46 GL_API void GL_APIENTRY
47 glDrawTexiOES(GLint x, GLint y, GLint z, GLint width, GLint height)
48 {
49 return;
50 }
51 #endif /* SDL_VIDEO_DRIVER_PANDORA */
52 51
53 /* OpenGL ES 1.1 renderer implementation, based on the OpenGL renderer */ 52 /* OpenGL ES 1.1 renderer implementation, based on the OpenGL renderer */
54 53
55 static const float inv255f = 1.0f / 255.0f; 54 static const float inv255f = 1.0f / 255.0f;
56 55
260 renderer->DestroyRenderer = GLES_DestroyRenderer; 259 renderer->DestroyRenderer = GLES_DestroyRenderer;
261 renderer->info = GL_ES_RenderDriver.info; 260 renderer->info = GL_ES_RenderDriver.info;
262 renderer->window = window->id; 261 renderer->window = window->id;
263 renderer->driverdata = data; 262 renderer->driverdata = data;
264 263
265
266 renderer->info.flags = 264 renderer->info.flags =
267 (SDL_RENDERER_PRESENTDISCARD | SDL_RENDERER_ACCELERATED); 265 (SDL_RENDERER_PRESENTDISCARD | SDL_RENDERER_ACCELERATED);
266
267 #if defined(__QNXNTO__)
268 #if _NTO_VERSION<=641
269 /* QNX's OpenGL ES implementation is broken regarding */
270 /* packed textures support, affected versions 6.3.2, 6.4.0, 6.4.1 */
271 renderer->info.num_texture_formats=2;
272 renderer->info.texture_formats[0]=SDL_PIXELFORMAT_ABGR8888;
273 renderer->info.texture_formats[1]=SDL_PIXELFORMAT_BGR24;
274 #endif /* _NTO_VERSION */
275 #endif /* __QNXNTO__ */
268 276
269 if (GLES_LoadFunctions(data) < 0) { 277 if (GLES_LoadFunctions(data) < 0) {
270 GLES_DestroyRenderer(renderer); 278 GLES_DestroyRenderer(renderer);
271 return NULL; 279 return NULL;
272 } 280 }
401 internalFormat = GL_RGBA; 409 internalFormat = GL_RGBA;
402 format = GL_RGBA; 410 format = GL_RGBA;
403 type = GL_UNSIGNED_SHORT_4_4_4_4; 411 type = GL_UNSIGNED_SHORT_4_4_4_4;
404 break; 412 break;
405 default: 413 default:
406 SDL_SetError("Unsupported texture format"); 414 SDL_SetError("Unsupported by OpenGL ES texture format");
407 return -1; 415 return -1;
408 } 416 }
409 417
410 data = (GLES_TextureData *) SDL_calloc(1, sizeof(*data)); 418 data = (GLES_TextureData *) SDL_calloc(1, sizeof(*data));
411 if (!data) { 419 if (!data) {