Mercurial > mplayer.hg
comparison libvo/gl_common.c @ 16474:01d27e023ae4
Improved glFindFormat
author | reimar |
---|---|
date | Tue, 13 Sep 2005 15:56:32 +0000 |
parents | f93eaa5ad64d |
children | 3191dcb27a12 |
comparison
equal
deleted
inserted
replaced
16473:d9697b778be2 | 16474:01d27e023ae4 |
---|---|
92 i++; | 92 i++; |
93 } | 93 } |
94 return "Unknown format!"; | 94 return "Unknown format!"; |
95 } | 95 } |
96 | 96 |
97 #undef TEXTUREFORMAT_ALWAYS | |
98 //! always return this format as internal texture format in glFindFormat | 97 //! always return this format as internal texture format in glFindFormat |
99 #define TEXTUREFORMAT_ALWAYS GL_RGB8 | 98 #define TEXTUREFORMAT_ALWAYS GL_RGB8 |
99 #undef TEXTUREFORMAT_ALWAYS | |
100 | 100 |
101 /** | 101 /** |
102 * \brief find the OpenGL settings coresponding to format. | 102 * \brief find the OpenGL settings coresponding to format. |
103 * | 103 * |
104 * All parameters may be NULL. | 104 * All parameters may be NULL. |
111 * \return 1 if format is supported by OpenGL, 0 if not. | 111 * \return 1 if format is supported by OpenGL, 0 if not. |
112 */ | 112 */ |
113 int glFindFormat(uint32_t fmt, uint32_t *bpp, GLint *gl_texfmt, | 113 int glFindFormat(uint32_t fmt, uint32_t *bpp, GLint *gl_texfmt, |
114 GLenum *gl_format, GLenum *gl_type) | 114 GLenum *gl_format, GLenum *gl_type) |
115 { | 115 { |
116 int supported = 1; | |
116 int dummy1; | 117 int dummy1; |
117 GLenum dummy2; | 118 GLenum dummy2; |
118 GLint dummy3; | 119 GLint dummy3; |
119 if (bpp == NULL) bpp = &dummy1; | 120 if (bpp == NULL) bpp = &dummy1; |
120 if (gl_texfmt == NULL) gl_texfmt = &dummy3; | 121 if (gl_texfmt == NULL) gl_texfmt = &dummy3; |
131 case IMGFMT_RGBA: | 132 case IMGFMT_RGBA: |
132 *gl_texfmt = 4; | 133 *gl_texfmt = 4; |
133 *gl_format = GL_RGBA; | 134 *gl_format = GL_RGBA; |
134 *gl_type = GL_UNSIGNED_BYTE; | 135 *gl_type = GL_UNSIGNED_BYTE; |
135 break; | 136 break; |
137 case IMGFMT_YV12: | |
138 supported = 0; // no native YV12 support | |
136 case IMGFMT_Y800: | 139 case IMGFMT_Y800: |
137 case IMGFMT_Y8: | 140 case IMGFMT_Y8: |
138 *gl_texfmt = 1; | 141 *gl_texfmt = 1; |
139 *bpp = 8; | 142 *bpp = 8; |
140 *gl_format = GL_LUMINANCE; | 143 *gl_format = GL_LUMINANCE; |
185 break; | 188 break; |
186 default: | 189 default: |
187 *gl_texfmt = 4; | 190 *gl_texfmt = 4; |
188 *gl_format = GL_RGBA; | 191 *gl_format = GL_RGBA; |
189 *gl_type = GL_UNSIGNED_BYTE; | 192 *gl_type = GL_UNSIGNED_BYTE; |
190 return 0; | 193 supported = 0; |
191 } | 194 } |
192 #ifdef TEXTUREFORMAT_ALWAYS | 195 #ifdef TEXTUREFORMAT_ALWAYS |
193 *gl_texfmt = TEXTUREFORMAT_ALWAYS; | 196 *gl_texfmt = TEXTUREFORMAT_ALWAYS; |
194 #endif | 197 #endif |
195 return 1; | 198 return supported; |
196 } | 199 } |
197 | 200 |
198 static void *setNull(const GLubyte *s) { | 201 static void *setNull(const GLubyte *s) { |
199 return NULL; | 202 return NULL; |
200 } | 203 } |