[MPlayer-cvslog] CVS: main/libvo gl_common.c, 1.13, 1.14 gl_common.h, 1.9, 1.10 vo_gl.c, 1.81, 1.82

Reimar Döffinger CVS syncmail at mplayerhq.hu
Tue Aug 16 19:57:55 CEST 2005


CVS change done by Reimar Döffinger CVS

Update of /cvsroot/mplayer/main/libvo
In directory mail:/var2/tmp/cvs-serv23194/libvo

Modified Files:
	gl_common.c gl_common.h vo_gl.c 
Log Message:
use GenBuffers to get a buffer number instead of hardcoding 1.


Index: gl_common.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/gl_common.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- gl_common.c	14 Aug 2005 19:38:16 -0000	1.13
+++ gl_common.c	16 Aug 2005 17:57:53 -0000	1.14
@@ -2,6 +2,8 @@
 #include <string.h>
 #include "gl_common.h"
 
+void (APIENTRY *GenBuffers)(GLsizei, GLuint *);
+void (APIENTRY *DeleteBuffers)(GLsizei, const GLuint *);
 void (APIENTRY *BindBuffer)(GLenum, GLuint);
 GLvoid* (APIENTRY *MapBuffer)(GLenum, GLenum); 
 GLboolean (APIENTRY *UnmapBuffer)(GLenum);
@@ -203,6 +205,12 @@
 static void getFunctions() {
   if (!getProcAddress)
     getProcAddress = setNull;
+  GenBuffers = getProcAddress("glGenBuffers");
+  if (!GenBuffers)
+    GenBuffers = getProcAddress("glGenBuffersARB");
+  DeleteBuffers = getProcAddress("glDeleteBuffers");
+  if (!DeleteBuffers)
+    DeleteBuffers = getProcAddress("glDeleteBuffersARB");
   BindBuffer = getProcAddress("glBindBuffer");
   if (!BindBuffer)
     BindBuffer = getProcAddress("glBindBufferARB");

Index: gl_common.h
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/gl_common.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- gl_common.h	14 Aug 2005 13:44:14 -0000	1.9
+++ gl_common.h	16 Aug 2005 17:57:53 -0000	1.10
@@ -85,6 +85,8 @@
 void releaseGlContext(XVisualInfo **vinfo, GLXContext *context);
 #endif
 
+extern void (APIENTRY *GenBuffers)(GLsizei, GLuint *);
+extern void (APIENTRY *DeleteBuffers)(GLsizei, const GLuint *);
 extern void (APIENTRY *BindBuffer)(GLenum, GLuint);
 extern GLvoid* (APIENTRY *MapBuffer)(GLenum, GLenum); 
 extern GLboolean (APIENTRY *UnmapBuffer)(GLenum);

Index: vo_gl.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_gl.c,v
retrieving revision 1.81
retrieving revision 1.82
diff -u -r1.81 -r1.82
--- vo_gl.c	14 Aug 2005 19:24:48 -0000	1.81
+++ vo_gl.c	16 Aug 2005 17:57:53 -0000	1.82
@@ -65,6 +65,7 @@
 static GLenum gl_texfmt;
 static GLenum gl_format;
 static GLenum gl_type;
+static GLint gl_buffer;
 static int gl_buffersize;
 
 static int int_pause;
@@ -147,6 +148,7 @@
 
   glClearColor( 0.0f,0.0f,0.0f,0.0f );
   glClear( GL_COLOR_BUFFER_BIT );
+  gl_buffer = 0;
   gl_buffersize = 0;
   err_shown = 0;
   return 1;
@@ -419,7 +421,7 @@
 }
 
 static uint32_t get_image(mp_image_t *mpi) {
-  if (!BindBuffer || !BufferData || !MapBuffer) {
+  if (!GenBuffers || !BindBuffer || !BufferData || !MapBuffer) {
     if (!err_shown)
       mp_msg(MSGT_VO, MSGL_ERR, "[gl] extensions missing for dr\n"
                                 "Expect a _major_ speed penalty\n");
@@ -429,7 +431,9 @@
   if (mpi->flags & MP_IMGFLAG_READABLE) return VO_FALSE;
   if (mpi->type == MP_IMGTYPE_IP || mpi->type == MP_IMGTYPE_IPB)
     return VO_FALSE; // we can not provide readable buffers
-  BindBuffer(GL_PIXEL_UNPACK_BUFFER, 1);
+  if (!gl_buffer)
+    GenBuffers(1, &gl_buffer);
+  BindBuffer(GL_PIXEL_UNPACK_BUFFER, gl_buffer);
   mpi->stride[0] = mpi->width * mpi->bpp / 8;
   if (mpi->stride[0] * mpi->h > gl_buffersize) {
     BufferData(GL_PIXEL_UNPACK_BUFFER, mpi->stride[0] * mpi->h,
@@ -457,7 +461,7 @@
     return VO_TRUE;
   if (mpi->flags & MP_IMGFLAG_DIRECT) {
     data = NULL;
-    BindBuffer(GL_PIXEL_UNPACK_BUFFER, 1);
+    BindBuffer(GL_PIXEL_UNPACK_BUFFER, gl_buffer);
     UnmapBuffer(GL_PIXEL_UNPACK_BUFFER);
     slice = 0; // always "upload" full texture
   }




More information about the MPlayer-cvslog mailing list