[vtkusers] OpenGL version error on macOS

Langer, Stephen A. (Fed) stephen.langer at nist.gov
Wed Aug 29 17:10:13 EDT 2018


Thanks for the suggestion, but that didn't make any difference.



I don't think the problem is the frameworks, actually.   I don't believe that the OpenGL framework provided by Apple supports X11, so there's no point in directing vtk towards it.



I can get vtk to link to the OpenGL libraries provided by the MacPorts' mesa and libGLU, but when it does, it complains about the OpenGL version.   The mesa in MacPorts is version is 17.1.6, which supports OpenGL 4.5, so it ought to work.  However, the Mesa release notes (https://www.mesa3d.org/relnotes/17.1.6.html) say this, which I don't completely understand:



Mesa 17.1.6 implements the OpenGL 4.5 API, but the version reported by glGetString(GL_VERSION) or glGetIntegerv(GL_MAJOR_VERSION) / glGetIntegerv(GL_MINOR_VERSION) depends on the particular driver being used. Some drivers don't support all the features required in OpenGL 4.5. OpenGL 4.5 is only available if requested at context creation because compatibility contexts are not supported.



That doesn't way what version is provided if 4.5 isn't requested.  But is it possible that vtk isn't getting the OpenGL context correctly?  I tried looking at the code but didn't get very far.  I'm not at all familiar with OpenGL.



-- Steve





On 8/29/18, 7:03 AM, "Elvis Stansvik" <elvis.stansvik at orexplore.com> wrote:



    I've only ever built with Cocoa. But it looks like VTK is using

    find_package(OpenGL ...) to find OpenGL, which in turn

    (FindOpenGL.cmake) uses find_library(OPENGL_gl_LIBRARY OpenGL DOC

    "OpenGL library for OS X") to find the library.



    Where find_library looks for macOS frameworks can be controlled using

    CMAKE_FRAMEWORK_PATH

    (https://cmake.org/cmake/help/latest/variable/CMAKE_FRAMEWORK_PATH.html#variable:CMAKE_FRAMEWORK_PATH),

    so perhaps try with



        -DCMAKE_FRAMEWORK_PATH:PATH=/path/to/where/your/GL/libs/are



    HTH,

    Elvis



    2018-08-27 17:54 GMT+02:00 Langer, Stephen A. (Fed) <stephen.langer at nist.gov>:

    > Hi --

    >

    >

    >

    > I finally need to actually solve a problem I encountered a year ago...  How

    > do I get vtk to use the correct version of OpenGL on macOS using X11?

    >

    >

    >

    > I downloaded and built CylinderRenderingProperties from the VTK examples

    > site.  When I run it, it says

    >

    >

    >

    > Warning: In

    > /Users/langer/UTIL/VTK/VTK-8.1.1/Rendering/OpenGL2/vtkOpenGLRenderWindow.cxx,

    > line 804

    >

    > vtkXOpenGLRenderWindow (0x7fa9fa81f800): VTK is designed to work with OpenGL

    > version 3.2 but it appears it has been given a context that does not support

    > 3.2. VTK will run in a compatibility mode designed to work with earlier

    > versions of OpenGL but some features may not work.

    >

    >

    >

    > and then seg faults.

    >

    >

    >

    > That was using vtk 8.1.1 build with VTK_USE_X11=ON and VTK_USE_COCOA=OFF.

    > OpenGL was provided by the MacPorts mesa and libGLU ports.  X11 was also

    > installed via MacPorts.

    >

    >

    >

    > If, on the other hand, I build vtk 8.1.1 with VTK_USE_COCOA=ON and

    > VTK_USE_X11=OFF, then it uses OpenGL from

    > /System/Library/Frameworks/OpenGL.framework, and CylinderRenderingProperties

    > compiles and runs correctly.

    >

    >

    >

    > Do I need to do something special when building or using VTK to get it to

    > find the correct version of OpenGL?

    >

    >

    >

    > (I'm running macOS High Sierra, but the problem existed with the previous OS

    > as well.)

    >

    >

    >

    > Thanks.

    >

    >     -- Steve

    >

    >

    >

    >

    > _______________________________________________

    > Powered by https://na01.safelinks.protection.outlook.com/?url=www.kitware.com&data=02%7C01%7Cstephen.langer%40nist.gov%7C4daf5756210546585ab808d60d9efef4%7C2ab5d82fd8fa4797a93e054655c61dec%7C1%7C0%7C636711373868698381&sdata=zw2bxe3tqPD5fssLtnBuG%2FRl85OjPbTsfcC91Z%2BOw8o%3D&reserved=0

    >

    > Visit other Kitware open-source projects at

    > https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.kitware.com%2Fopensource%2Fopensource.html&data=02%7C01%7Cstephen.langer%40nist.gov%7C4daf5756210546585ab808d60d9efef4%7C2ab5d82fd8fa4797a93e054655c61dec%7C1%7C0%7C636711373868698381&sdata=PcYBqXP0j4eVWPzKggeLrqAQ7WiY9LnNtUkiZDxknRs%3D&reserved=0

    >

    > Please keep messages on-topic and check the VTK FAQ at:

    > https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.vtk.org%2FWiki%2FVTK_FAQ&data=02%7C01%7Cstephen.langer%40nist.gov%7C4daf5756210546585ab808d60d9efef4%7C2ab5d82fd8fa4797a93e054655c61dec%7C1%7C0%7C636711373868698381&sdata=uGa1FqKpH99%2FCE%2F6fuqHCtHT1aB8ZIF1whf3WOAbU5E%3D&reserved=0

    >

    > Search the list archives at: https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmarkmail.org%2Fsearch%2F%3Fq%3Dvtkusers&data=02%7C01%7Cstephen.langer%40nist.gov%7C4daf5756210546585ab808d60d9efef4%7C2ab5d82fd8fa4797a93e054655c61dec%7C1%7C0%7C636711373868698381&sdata=W8JHLG0N9x3mhkk4XC3ESXsQxcbq73fpsp0zArKboPQ%3D&reserved=0

    >

    > Follow this link to subscribe/unsubscribe:

    > https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpublic.kitware.com%2Fmailman%2Flistinfo%2Fvtkusers&data=02%7C01%7Cstephen.langer%40nist.gov%7C4daf5756210546585ab808d60d9efef4%7C2ab5d82fd8fa4797a93e054655c61dec%7C1%7C0%7C636711373868698381&sdata=ez3xU4rzNT7kcWNTGsTOKs8HleLU1ykmGsgigHwvwxU%3D&reserved=0

    >


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://public.kitware.com/pipermail/vtkusers/attachments/20180829/676e4cc0/attachment.html>


More information about the vtkusers mailing list