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

David Gobbi dgobbi at atamai.com
Wed Nov 1 12:58:28 EST 2006


Silly me, I looked at vtkOpenGLTextureMapper3D.cxx and it is already 
100% extensions based, it doesn't require GL_VERSION_2_0 at all.  I 
should have remembered that from when I did the first Mac fix to this 
class a few weeks ago.

The problem is that Apple's OpenGL does not report the 3D texture 
mapping extension, even though 3D texture mapping is supported.  My 
previous solution was to use vtkgl::TexImage3D, which is only available 
if at least GL_VERSION_1_2 is loaded.  Nothing to do with OpenGL 2.0 at all.

 - David



David Gobbi wrote:
> Hi Ken,
>
> Thanks for the feedback.  Perhaps the best fix for 
> vtkOpenGLTextureMapper3D is to specifically disable only the shader 
> programming when GL_VERSION_2_0 is not present, but I'll have to look 
> deeper into the code to see if this would work.  Otherwise I'll either 
> have to bite the bullet and go with your OpenGL 1.3 extension 
> suggestion, or load GL_VERSION_2_0 inside an #ifdef __APPLE__.
>
> I'm CC'ing Lisa Avila in case she might know whether it would be 
> possible (and desirable) to convert this class to use OpenGL <= 1.3.
>
> - David
>
>
>
> kmorel wrote:
>> 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
>>>
>>>
>>>
>>>
>>>     
>>
>>
>>
>>   
>
> _______________________________________________
> vtk-developers mailing list
> vtk-developers at vtk.org
> http://www.vtk.org/mailman/listinfo/vtk-developers
>




More information about the vtk-developers mailing list