On Thursday, 4 June 2009 at 15:42, bugs buggy wrote:
> The problem with this hack is, that if we keep this in, then this hack
> is enabled for *all* people on linux, if they need it or not.
>
> AFAIK, we can't detect what drivers people are using, so the below
> error message is spit out for everyone on linux.
>
> If people don't report about the problem to the driver guys, then it
> don't get fixed.
Afaik this only affects Mesa, not any other drivers. And the Mesa guys are
currently busy with Gallium, so I don't think they will do full OpenGL 1.5 for
the "old" Mesa.
> This is bad.
> I am thinking we should revert the hack altogether.
> Opinions?
Actually there is no need to do the hack in GLee.c, so we can move it somewhere
we can check the GL_RENDERER string. See patch.
diff --git a/lib/ivis_opengl/GLee.c b/lib/ivis_opengl/GLee.c
index 499fcbd..9cc4613 100644
--- a/lib/ivis_opengl/GLee.c
+++ b/lib/ivis_opengl/GLee.c
@@ -12000,21 +12000,6 @@ GLuint __GLeeLink_GL_ARB_vertex_buffer_object(void)
if ((GLeeFuncPtr_glGetBufferParameterivARB = (GLEEPFNGLGETBUFFERPARAMETERIVARBPROC) __GLeeGetProcAddress("glGetBufferParameterivARB"))!=0) nLinked++;
if ((GLeeFuncPtr_glGetBufferPointervARB = (GLEEPFNGLGETBUFFERPOINTERVARBPROC) __GLeeGetProcAddress("glGetBufferPointervARB"))!=0) nLinked++;
- // NOTE: this hack causes issues with MAC OS
- // HACK: work around for drivers that report VBO, but don't have full openGL 1.5 implementation.
- #if defined(WZ_OS_UNIX) && !defined(WZ_OS_MAC)
- GLeeFuncPtr_glBindBuffer = GLeeFuncPtr_glBindBufferARB;
- GLeeFuncPtr_glDeleteBuffers = GLeeFuncPtr_glDeleteBuffersARB;
- GLeeFuncPtr_glGenBuffers = GLeeFuncPtr_glGenBuffersARB;
- GLeeFuncPtr_glIsBuffer = GLeeFuncPtr_glIsBufferARB;
- GLeeFuncPtr_glBufferData = GLeeFuncPtr_glBufferDataARB;
- GLeeFuncPtr_glBufferSubData = GLeeFuncPtr_glBufferSubDataARB;
- GLeeFuncPtr_glGetBufferSubData = GLeeFuncPtr_glGetBufferSubDataARB;
- GLeeFuncPtr_glMapBuffer = GLeeFuncPtr_glMapBufferARB;
- GLeeFuncPtr_glUnmapBuffer = GLeeFuncPtr_glUnmapBufferARB;
- GLeeFuncPtr_glGetBufferParameteriv = GLeeFuncPtr_glGetBufferParameterivARB;
- GLeeFuncPtr_glGetBufferPointerv = GLeeFuncPtr_glGetBufferPointervARB;
- #endif
#endif
if (nLinked==11) return GLEE_LINK_COMPLETE;
if (nLinked==0) return GLEE_LINK_FAIL;
diff --git a/lib/ivis_opengl/screen.c b/lib/ivis_opengl/screen.c
index 05b6f88..031e7dd 100644
--- a/lib/ivis_opengl/screen.c
+++ b/lib/ivis_opengl/screen.c
@@ -171,7 +171,6 @@ BOOL screenInitialise(
{
debug( LOG_ERROR, "OpenGL initialization did not give double buffering!" );
}
- // Note that no initialisation of GLee is required, since this is handled automatically.
/* Dump information about OpenGL implementation to the console */
debug(LOG_3D, "OpenGL Vendor : %s", glGetString(GL_VENDOR));
@@ -193,6 +192,27 @@ BOOL screenInitialise(
debug(LOG_3D, " * Rectangular texture %s supported.", GLEE_ARB_texture_rectangle ? "is" : "is NOT");
debug(LOG_3D, " * FrameBuffer Object (FBO) %s supported.", GLEE_EXT_framebuffer_object ? "is" : "is NOT");
+ // Some drivers, namely Mesa, don't support VBOs, but not full OpenGL
+ // 1.5, so work around that.
+ if (!strncmp((const char *)glGetString(GL_RENDERER), "Mesa", 4))
+ {
+ debug(LOG_ERROR, "Using Mesa hack");
+ // Usually GLee is initialized automatically when needed, but
+ // for this hack to work it has to be done here.
+ GLeeInit();
+ GLeeFuncPtr_glBindBuffer = GLeeFuncPtr_glBindBufferARB;
+ GLeeFuncPtr_glDeleteBuffers = GLeeFuncPtr_glDeleteBuffersARB;
+ GLeeFuncPtr_glGenBuffers = GLeeFuncPtr_glGenBuffersARB;
+ GLeeFuncPtr_glIsBuffer = GLeeFuncPtr_glIsBufferARB;
+ GLeeFuncPtr_glBufferData = GLeeFuncPtr_glBufferDataARB;
+ GLeeFuncPtr_glBufferSubData = GLeeFuncPtr_glBufferSubDataARB;
+ GLeeFuncPtr_glGetBufferSubData = GLeeFuncPtr_glGetBufferSubDataARB;
+ GLeeFuncPtr_glMapBuffer = GLeeFuncPtr_glMapBufferARB;
+ GLeeFuncPtr_glUnmapBuffer = GLeeFuncPtr_glUnmapBufferARB;
+ GLeeFuncPtr_glGetBufferParameteriv = GLeeFuncPtr_glGetBufferParameterivARB;
+ GLeeFuncPtr_glGetBufferPointerv = GLeeFuncPtr_glGetBufferPointervARB;
+ }
+
glViewport(0, 0, width, height);
glMatrixMode(GL_PROJECTION);
glPushMatrix();
___
Warzone-dev mailing list
Warzone-dev@gna.org
https://mail.gna.org/listinfo/warzone-dev