comparison libvo/gl_common.c @ 35010:4f99cedb5141

Hack to make BGRA work both in GL and GLES.
author reimar
date Sat, 18 Aug 2012 18:44:13 +0000
parents 4ba5b32b61ac
children 078a00af881c
comparison
equal deleted inserted replaced
35009:4ba5b32b61ac 35010:4f99cedb5141
350 case IMGFMT_BGR24: 350 case IMGFMT_BGR24:
351 *gl_format = GL_BGR; 351 *gl_format = GL_BGR;
352 *gl_type = GL_UNSIGNED_BYTE; 352 *gl_type = GL_UNSIGNED_BYTE;
353 break; 353 break;
354 case IMGFMT_BGRA: 354 case IMGFMT_BGRA:
355 *gl_texfmt = GL_BGRA; 355 *gl_texfmt = GL_RGBA;
356 *gl_format = GL_BGRA; 356 *gl_format = GL_BGRA;
357 *gl_type = GL_UNSIGNED_BYTE; 357 *gl_type = GL_UNSIGNED_BYTE;
358 break; 358 break;
359 default: 359 default:
360 *gl_texfmt = GL_RGBA; 360 *gl_texfmt = GL_RGBA;
565 char *init; 565 char *init;
566 if (w == 0) w = 1; 566 if (w == 0) w = 1;
567 if (h == 0) h = 1; 567 if (h == 0) h = 1;
568 stride = w * glFmt2bpp(format, type); 568 stride = w * glFmt2bpp(format, type);
569 if (!stride) return; 569 if (!stride) return;
570 // For BGRA internal format must be BGRA for GLES and RGBA for GL...
571 if (format == GL_BGRA && !mpglBegin) fmt = GL_BGRA;
570 init = malloc(stride * h); 572 init = malloc(stride * h);
571 memset(init, val, stride * h); 573 memset(init, val, stride * h);
572 glAdjustAlignment(stride); 574 glAdjustAlignment(stride);
573 mpglPixelStorei(GL_UNPACK_ROW_LENGTH, w); 575 mpglPixelStorei(GL_UNPACK_ROW_LENGTH, w);
574 // This needs to be here before the very first TexImage call to get 576 // This needs to be here before the very first TexImage call to get