}
}
+static GLint GetInternalFormat(GLint format, int bpp)
+{
+ if(bpp == 2)
+ {
+ switch (format)
+ {
+#ifdef GL_ALPHA16
+ case GL_ALPHA: return GL_ALPHA16;
+#endif
+#ifdef GL_LUMINANCE16
+ case GL_LUMINANCE: return GL_LUMINANCE16;
+#endif
+ default: return format;
+ }
+ }
+ else
+ return format;
+}
+
bool CLinuxRendererGL::CreateYV12Texture(int index)
{
/* since we also want the field textures, pitch must be texture aligned */
GLenum format;
GLint internalformat;
if (p == 2) //V plane needs an alpha texture
- {
format = GL_ALPHA;
- if(im.bpp == 2)
- internalformat = GL_ALPHA16;
- else
- internalformat = GL_ALPHA;
- }
else
- {
format = GL_LUMINANCE;
- if(im.bpp == 2)
- internalformat = GL_LUMINANCE16;
- else
- internalformat = GL_LUMINANCE;
- }
+ internalformat = GetInternalFormat(format, im.bpp);
glTexImage2D(m_textureTarget, 0, internalformat, plane.texwidth, plane.texheight, 0, format, GL_UNSIGNED_BYTE, NULL);
}