# HG changeset patch # User reimar # Date 1084052321 0 # Node ID d97398ed403e1e9d135e0e1918cd2b0988533897 # Parent 0971849c04b69b90ba62572c86084a0f5213e1f3 changes to get manyfmts nearer to working and fixed memory leak diff -r 0971849c04b6 -r d97398ed403e libvo/vo_gl.c --- a/libvo/vo_gl.c Sat May 08 18:00:11 2004 +0000 +++ b/libvo/vo_gl.c Sat May 08 21:38:41 2004 +0000 @@ -32,9 +32,6 @@ LIBVO_EXTERN(gl) -/* local data */ -static unsigned char *ImageData=NULL; - static GLXContext wsGLXContext; static int wsGLXAttrib[] = { GLX_RGBA, GLX_RED_SIZE,1, @@ -48,6 +45,7 @@ static uint32_t image_height; static uint32_t image_bytes; static int many_fmts; +static GLenum gl_texfmt; static GLenum gl_format; static GLenum gl_type; @@ -72,17 +70,22 @@ 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_RGB32: + 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; @@ -120,15 +123,20 @@ gl_type = GL_UNSIGNED_BYTE; break; case IMGFMT_BGR32: + 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_32BPP + gl_texfmt = GL_RGB8; +#endif return 1; } @@ -138,6 +146,7 @@ static uint32_t config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t flags, char *title, uint32_t format) { + unsigned char *ImageData=NULL; // int screen; unsigned int fg, bg; XSizeHints hint; @@ -230,9 +239,6 @@ while(texture_width