[MPlayer-cvslog] r35982 - in trunk/libvo: gl_common.c gl_common.h gl_compat.h matrixview.c vo_gl.c

reimar subversion at mplayerhq.hu
Sat Mar 16 16:18:16 CET 2013


Author: reimar
Date: Sat Mar 16 16:18:15 2013
New Revision: 35982

Log:
Better compatibility with more restricted GL headers.

Modified:
   trunk/libvo/gl_common.c
   trunk/libvo/gl_common.h
   trunk/libvo/gl_compat.h
   trunk/libvo/matrixview.c
   trunk/libvo/vo_gl.c

Modified: trunk/libvo/gl_common.c
==============================================================================
--- trunk/libvo/gl_common.c	Sat Mar 16 16:17:26 2013	(r35981)
+++ trunk/libvo/gl_common.c	Sat Mar 16 16:18:15 2013	(r35982)
@@ -67,7 +67,7 @@ void (GLAPIENTRY *mpglTexEnvi)(GLenum, G
 void (GLAPIENTRY *mpglColor4ub)(GLubyte, GLubyte, GLubyte, GLubyte);
 void (GLAPIENTRY *mpglColor4f)(GLfloat, GLfloat, GLfloat, GLfloat);
 void (GLAPIENTRY *mpglClearColor)(GLclampf, GLclampf, GLclampf, GLclampf);
-void (GLAPIENTRY *mpglClearDepth)(GLclampd);
+void (GLAPIENTRY *mpglClearDepthf)(GLclampf);
 void (GLAPIENTRY *mpglDepthFunc)(GLenum);
 void (GLAPIENTRY *mpglEnable)(GLenum);
 void (GLAPIENTRY *mpglDisable)(GLenum);
@@ -92,6 +92,7 @@ void (GLAPIENTRY *mpglLightfv)(GLenum, G
 void (GLAPIENTRY *mpglColorMaterial)(GLenum, GLenum);
 void (GLAPIENTRY *mpglShadeModel)(GLenum);
 void (GLAPIENTRY *mpglGetIntegerv)(GLenum, GLint *);
+static void (GLAPIENTRY *mpglGetTexLevelParameteriv)(GLenum, GLint, GLenum, GLint *);
 void (GLAPIENTRY *mpglColorMask)(GLboolean, GLboolean, GLboolean, GLboolean);
 
 /**
@@ -430,7 +431,7 @@ static const extfunc_desc_t extfuncs[] =
   DEF_FUNC_DESC(Color4ub),
   DEF_FUNC_DESC(Color4f),
   DEF_FUNC_DESC(ClearColor),
-  DEF_FUNC_DESC(ClearDepth),
+  DEF_FUNC_DESC(ClearDepthf),
   DEF_FUNC_DESC(DepthFunc),
   DEF_FUNC_DESC(Enable),
   DEF_FUNC_DESC(Disable),
@@ -454,6 +455,7 @@ static const extfunc_desc_t extfuncs[] =
   DEF_FUNC_DESC(ColorMaterial),
   DEF_FUNC_DESC(ShadeModel),
   DEF_FUNC_DESC(GetIntegerv),
+  DEF_FUNC_DESC(GetTexLevelParameteriv),
   DEF_FUNC_DESC(ColorMask),
 
   // here start the real extensions
@@ -584,7 +586,7 @@ void glCreateClearTex(GLenum target, GLe
   if (format == GL_LUMINANCE && type == GL_UNSIGNED_SHORT) {
     // ensure we get enough bits
     GLint bits = 0;
-    glGetTexLevelParameteriv(target, 0, GL_TEXTURE_LUMINANCE_SIZE, &bits);
+    mpglGetTexLevelParameteriv(target, 0, GL_TEXTURE_LUMINANCE_SIZE, &bits);
     if (bits > 0 && bits < 14 && (use_depth_l16 || HAVE_BIGENDIAN)) {
       fmt = GL_DEPTH_COMPONENT16;
       format = GL_DEPTH_COMPONENT;

Modified: trunk/libvo/gl_common.h
==============================================================================
--- trunk/libvo/gl_common.h	Sat Mar 16 16:17:26 2013	(r35981)
+++ trunk/libvo/gl_common.h	Sat Mar 16 16:18:15 2013	(r35982)
@@ -250,7 +250,7 @@ extern void (GLAPIENTRY *mpglTexEnvi)(GL
 extern void (GLAPIENTRY *mpglColor4ub)(GLubyte, GLubyte, GLubyte, GLubyte);
 extern void (GLAPIENTRY *mpglColor4f)(GLfloat, GLfloat, GLfloat, GLfloat);
 extern void (GLAPIENTRY *mpglClearColor)(GLclampf, GLclampf, GLclampf, GLclampf);
-extern void (GLAPIENTRY *mpglClearDepth)(GLclampd);
+extern void (GLAPIENTRY *mpglClearDepthf)(GLclampf);
 extern void (GLAPIENTRY *mpglDepthFunc)(GLenum);
 extern void (GLAPIENTRY *mpglEnable)(GLenum);
 extern void (GLAPIENTRY *mpglDisable)(GLenum);

Modified: trunk/libvo/gl_compat.h
==============================================================================
--- trunk/libvo/gl_compat.h	Sat Mar 16 16:17:26 2013	(r35981)
+++ trunk/libvo/gl_compat.h	Sat Mar 16 16:18:15 2013	(r35982)
@@ -35,6 +35,127 @@
 #endif
 #endif
 
+// base OpenGL defines
+#ifndef GL_NONE
+#define GL_NONE 0
+#endif
+
+#ifndef GL_QUADS
+#define GL_QUADS 0x0007
+#endif
+
+#ifndef GL_FRONT_LEFT
+#define GL_FRONT_LEFT 0x0400
+#endif
+#ifndef GL_FRONT_RIGHT
+#define GL_FRONT_RIGHT 0x0401
+#endif
+#ifndef GL_BACK_LEFT
+#define GL_BACK_LEFT 0x0402
+#endif
+#ifndef GL_BACK_RIGHT
+#define GL_BACK_RIGHT 0x0403
+#endif
+
+#ifndef GL_DRAW_BUFFER
+#define GL_DRAW_BUFFER 0x0C01
+#endif
+#ifndef GL_UNPACK_ROW_LENGTH
+#define GL_UNPACK_ROW_LENGTH 0x0CF2
+#endif
+
+#ifndef GL_TEXTURE_1D
+#define GL_TEXTURE_1D 0x0DE0
+#endif
+#ifndef GL_TEXTURE_BORDER_COLOR
+#define GL_TEXTURE_BORDER_COLOR 0x1004
+#endif
+#ifndef GL_COMPILE
+#define GL_COMPILE 0x1300
+#endif
+#ifndef GL_CLAMP
+#define GL_CLAMP 0x2900
+#endif
+
+#ifndef GL_INT
+#define GL_INT 0x1404
+#endif
+#ifndef GL_2_BYTES
+#define GL_2_BYTES 0x1407
+#endif
+#ifndef GL_3_BYTES
+#define GL_3_BYTES 0x1408
+#endif
+#ifndef GL_4_BYTES
+#define GL_4_BYTES 0x1409
+#endif
+#ifndef GL_DOUBLE
+#define GL_DOUBLE 0x140A
+#endif
+
+#ifndef GL_COLOR_INDEX
+#define GL_COLOR_INDEX 0x1900
+#endif
+#ifndef GL_RED
+#define GL_RED 0x1903
+#endif
+#ifndef GL_GREEN
+#define GL_GREEN 0x1904
+#endif
+#ifndef GL_BLUE
+#define GL_BLUE 0x1905
+#endif
+#ifndef GL_R3_G3_B2
+#define GL_R3_G3_B2 0x2A10
+#endif
+#ifndef GL_LUMINANCE8
+#define GL_LUMINANCE8 0x8040
+#endif
+#ifndef GL_RGB4
+#define GL_RGB4 0x804F
+#endif
+#ifndef GL_RGB5
+#define GL_RGB5 0x8050
+#endif
+#ifndef GL_RGB8
+#define GL_RGB8 0x8051
+#endif
+#ifndef GL_RGB10
+#define GL_RGB10 0x8052
+#endif
+#ifndef GL_RGB12
+#define GL_RGB12 0x8053
+#endif
+#ifndef GL_RGB16
+#define GL_RGB16 0x8054
+#endif
+#ifndef GL_RGBA2
+#define GL_RGBA2 0x8055
+#endif
+#ifndef GL_RGBA4
+#define GL_RGBA4 0x8056
+#endif
+#ifndef GL_RGB5_A1
+#define GL_RGB5_A1 0x8057
+#endif
+#ifndef GL_RGBA8
+#define GL_RGBA8  0x8058
+#endif
+#ifndef GL_RGB10_A2
+#define GL_RGB10_A2 0x8059
+#endif
+#ifndef GL_RGBA12
+#define GL_RGBA12 0x805A
+#endif
+#ifndef GL_RGBA16
+#define GL_RGBA16 0x805B
+#endif
+
+#ifndef GL_TEXTURE_PRIORITY
+#define GL_TEXTURE_PRIORITY 0x8066
+#endif
+
+
 /**
  * \defgroup glextdefines OpenGL extension defines
  *

Modified: trunk/libvo/matrixview.c
==============================================================================
--- trunk/libvo/matrixview.c	Sat Mar 16 16:17:26 2013	(r35981)
+++ trunk/libvo/matrixview.c	Sat Mar 16 16:18:15 2013	(r35982)
@@ -278,7 +278,7 @@ void matrixview_init(int w, int h)
     mpglClearColor(0.0f, 0.0f, 0.0f, 0.0f);
 
     // Depth to clear depth buffer to; type of test.
-    mpglClearDepth(1.0);
+    mpglClearDepthf(1.0);
     mpglDepthFunc(GL_LESS);
 
     // Enables Smooth Color Shading; try GL_FLAT for (lack of) fun.

Modified: trunk/libvo/vo_gl.c
==============================================================================
--- trunk/libvo/vo_gl.c	Sat Mar 16 16:17:26 2013	(r35981)
+++ trunk/libvo/vo_gl.c	Sat Mar 16 16:18:15 2013	(r35982)
@@ -195,13 +195,13 @@ static void resize(int x,int y){
   ass_border_x = ass_border_y = 0;
   if (aspect_scaling() && use_aspect) {
     int new_w, new_h;
-    GLdouble scale_x, scale_y;
+    double scale_x, scale_y;
     aspect(&new_w, &new_h, A_WINZOOM);
     panscan_calc_windowed();
     new_w += vo_panscan_x;
     new_h += vo_panscan_y;
-    scale_x = (GLdouble)new_w / (GLdouble)x;
-    scale_y = (GLdouble)new_h / (GLdouble)y;
+    scale_x = (double)new_w / (double)x;
+    scale_y = (double)new_h / (double)y;
     matrix[0]  *= scale_x;
     matrix[12] *= scale_x;
     matrix[5]  *= scale_y;


More information about the MPlayer-cvslog mailing list