[vtk-developers] Re: Recent patch broke OpenGL 2.0 on OS X

kmorel kmorel at sandia.gov
Wed Nov 1 11:19:10 EST 2006


Sorry, but no.  That is not an acceptable change.  The problem is that the
code you have suggested will cause the GLSL test to crash on Mesa platforms.
The problem here is that I found out, the hard way, that successfully
loading functions of an extension does not necessarily indicate that the
extension is supported (or even that the function actually has an
implementation).

I had the same problem you are having on the Mac concerning the support of
GLSL.  It worked on my Mac before the change but did not work afterwards.
After looking online, it appears that the Mac drivers do not actually
support all of OpenGL 2.0.  Although much (most?) of OpenGL 2.0 is supported
and if you load those functions they will work, there is apparently parts
that will not.  Thus, it is dangerous to use OpenGL 2.0 on a Mac as you may
run into something that does not work as it should. (That may be why you are
finding your OpenGL 2.0 extensions do not work if you do not also load
OpenGL 1.3.)

My solution for GLSL was to use OpenGL 1.3 extensions rather than OpenGL 2.0
directly.  There is a set of registered extensions that allow access to the
shading language made available in OpenGL 2.0.  If you look at
vtkGLSLShader.cxx and vtkGLSLShaderProgram.cxx, you can see the changes I
made to make GLSL work both on machines that support OpenGL 2.0 and machines
that do not support OpenGL 2.0 but support an appropriate set of extensions
instead (i.e. the Mac).  I am willing to bet that you can find a set of
extensions as an alternative to using OpenGL 2.0 that will allow
vtkOpenGLTextureMapper3D to work on the Mac.

-Ken


On 11/1/06 10:32 AM, "David Gobbi" <dgobbi at atamai.com> wrote:

> Hi Ken,
> 
> Your recent change to vtkOpenGLExtensionManager.cxx has broken the
> vtkOpenGLTextureMapper3D on the Mac.
> 
> The OpenGL driver on my Mac returns "1.5 ATI-1.4.18" as the version but
> has GL_VERSION_2_0 as an extension, so the new extension reporting
> method that you added doesn't recognize that my Mac supports 2.0.  The
> situation gets even more complicated:  from my experimentation, I found
> that I have to load "GL_VERSION_1_3" as an extension before
> "GL_VERSION_2_0" can be loaded.
> 
> The following code (at around line 248) works on the Mac by attempting
> loading each version extension, and then doing your additional checks:
> 
> 
>     int tryMajor, tryMinor;
>     sscanf(ve.c_str(), "GL_VERSION_%d_%d", &tryMajor, &tryMinor);
>     if ( (vtkgl::LoadExtension(ve.c_str(), this) != 0)
>         || (driverMajor > tryMajor)
>         || ((driverMajor == tryMajor) && (driverMinor >= tryMinor)) )
>       {
>       // OpenGL version supported.
>       extensions_string += " ";
>       extensions_string += ve;
>       }
> 
> 
> Do you see any problems if the above code is committed?
> 
> Thanks,
> 
>  - David
> 
> 
> 
> 





More information about the vtk-developers mailing list