summaryrefslogtreecommitdiffstats
path: root/libvo/vo_gl.c
diff options
context:
space:
mode:
authorreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2004-12-01 17:05:58 +0000
committerreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2004-12-01 17:05:58 +0000
commitc977dab4562f5ee1324a971d396a997baf341383 (patch)
treeb13a36cea80220e5c68a83822fe7d410ed48bb9f /libvo/vo_gl.c
parente6524e5b0958e8b798e160c6ae555f5495c5f5eb (diff)
downloadmpv-c977dab4562f5ee1324a971d396a997baf341383.tar.bz2
mpv-c977dab4562f5ee1324a971d396a997baf341383.tar.xz
More similar code from gl and gl2 moved to gl_common
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@14079 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libvo/vo_gl.c')
-rw-r--r--libvo/vo_gl.c86
1 files changed, 4 insertions, 82 deletions
diff --git a/libvo/vo_gl.c b/libvo/vo_gl.c
index 458ca4189d..079d3f1be0 100644
--- a/libvo/vo_gl.c
+++ b/libvo/vo_gl.c
@@ -1,5 +1,3 @@
-#define TEXTUREFORMAT_ALWAYS GL_RGB8
-
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -104,84 +102,6 @@ static void resize(int x,int y){
}
}
-static int find_gl_format (uint32_t format)
-{
- image_bytes = (IMGFMT_RGB_DEPTH(format)+7)/8;
- gl_texfmt = 3;
- switch (format) {
- case IMGFMT_RGB24:
- gl_format = GL_RGB;
- gl_type = GL_UNSIGNED_BYTE;
- break;
- case IMGFMT_RGBA:
- gl_texfmt = 4;
- gl_format = GL_RGBA;
- gl_type = GL_UNSIGNED_BYTE;
- break;
- case IMGFMT_Y800:
- case IMGFMT_Y8:
- gl_texfmt = 1;
- image_bytes = 1;
- gl_format = GL_LUMINANCE;
- gl_type = GL_UNSIGNED_BYTE;
- break;
-#ifdef GL_VERSION_1_2
-#if 0
- // we do not support palettized formats, although the format the
- // swscale produces works
- case IMGFMT_RGB8:
- gl_format = GL_RGB;
- gl_type = GL_UNSIGNED_BYTE_2_3_3_REV;
- break;
-#endif
- case IMGFMT_RGB15:
- gl_format = GL_RGBA;
- gl_type = GL_UNSIGNED_SHORT_1_5_5_5_REV;
- break;
- case IMGFMT_RGB16:
- gl_format = GL_RGB;
- gl_type = GL_UNSIGNED_SHORT_5_6_5_REV;
- break;
-#if 0
- case IMGFMT_BGR8:
- // special case as red and blue have a differen number of bits.
- // GL_BGR and GL_UNSIGNED_BYTE_3_3_2 isn't supported at least
- // by nVidia drivers, and in addition would give more bits to
- // blue than to red, which isn't wanted
- gl_format = GL_RGB;
- gl_type = GL_UNSIGNED_BYTE_3_3_2;
- break;
-#endif
- case IMGFMT_BGR15:
- gl_format = GL_BGRA;
- gl_type = GL_UNSIGNED_SHORT_1_5_5_5_REV;
- break;
- case IMGFMT_BGR16:
- gl_format = GL_RGB;
- gl_type = GL_UNSIGNED_SHORT_5_6_5;
- break;
- case IMGFMT_BGR24:
- gl_format = GL_BGR;
- gl_type = GL_UNSIGNED_BYTE;
- break;
- case IMGFMT_BGRA:
- gl_texfmt = 4;
- gl_format = GL_BGRA;
- gl_type = GL_UNSIGNED_BYTE;
- break;
-#endif
- default:
- gl_texfmt = 4;
- gl_format = GL_RGBA;
- gl_type = GL_UNSIGNED_BYTE;
- return 0;
- }
-#ifdef TEXTUREFORMAT_ALWAYS
- gl_texfmt = TEXTUREFORMAT_ALWAYS;
-#endif
- return 1;
-}
-
/**
* \brief Initialize a (new or reused) OpenGL context.
*/
@@ -230,7 +150,8 @@ config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uin
{
image_height = height;
image_width = width;
- find_gl_format (format);
+ glFindFormat(format, &image_bytes, &gl_texfmt, &gl_format, &gl_type);
+ image_bytes = (image_bytes + 7) / 8;
sub_bg_alpha = 255; // We need alpha = 255 for invisible part of the OSD
int_pause = 0;
@@ -529,7 +450,8 @@ query_format(uint32_t format)
caps |= VFCAP_OSD;
if ((format == IMGFMT_RGB24) || (format == IMGFMT_RGBA))
return caps;
- if (many_fmts && find_gl_format(format))
+ if (many_fmts &&
+ glFindFormat(format, NULL, NULL, NULL, NULL))
return caps;
return 0;
}