[vtkusers] OpenGL version error on macOS

David Gobbi david.gobbi at gmail.com
Wed Aug 29 17:42:39 EDT 2018


Have you installed XQuartz?  It provides a full set of headers and
libraries for X11 and OpenGL in /opt, and the latest version number listed
in its headers is GL_VERSION_4_5.

It has been many years since I've built VTK with X11 on the Mac, but
XQuartz was where I always got the dev files from.

 - David


On Wed, Aug 29, 2018 at 3:10 PM Langer, Stephen A. (Fed) <
stephen.langer at nist.gov> wrote:

> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://public.kitware.com/pipermail/vtkusers/attachments/20180829/1e6a0b1c/attachment.html>


More information about the vtkusers mailing list