[vtkusers] OpenGL version error on macOS
David Gobbi
david.gobbi at gmail.com
Thu Aug 30 11:37:19 EDT 2018
I ran 'glxinfo' under xquartz on my own machine and it reports OpenGL 2.1.
This might be a limitation of glx or xquartz, rather than a limitation of
the underlying OpenGL libraries or the hardware.
If you have a linux machine, you can try doing X11 via ssh (with ssh -Y) to
see if the results are different on a different xserver.
And there is also the option of building a full-software Mesa (i.e.
unaccelerated). People often do this on Windows, since accelerated
graphics don't always work with remote desktop.
For myself, since I use Windows on VirtualBox which has limited OpenGL
support, I'm still building my Windows VTK apps with the old OpenGL backend.
- David
On Thu, Aug 30, 2018 at 9:11 AM Langer, Stephen A. (Fed) <
stephen.langer at nist.gov> wrote:
> Yes, I have all of the X11 libraries and the server installed from
> MacPorts. X11 programs that don't use vtk, such as glxgears, run
> correctly. Poking around with "otool -L" shows that glxgears and
> CylinderRenderingProperties are linking to the same X and GL libraries,
> with the possible exception of libvtkglew, which as far as I can tell isn't
> equivalent to anything loaded by glxgears.
>
>
>
> Setting MESA_GL_VERSION_OVERRIDE as Elvis suggested didn't make any
> difference.
>
>
>
> -- Steve
>
>
>
> On 8/29/18, 5:43 PM, "David Gobbi" <david.gobbi at gmail.com> wrote:
>
>
>
> 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
> <https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.mesa3d.org%2Frelnotes%2F17.1.6.html&data=02%7C01%7Cstephen.langer%40nist.gov%7C171ff2b34fed4f31b25808d60df864fd%7C2ab5d82fd8fa4797a93e054655c61dec%7C1%7C0%7C636711757824634629&sdata=vbhYyPK6rqtl6p64DyEoxfv%2F%2F3RLVs0QEAw9y3X%2Fb74%3D&reserved=0>)
> 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
> <https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fcmake.org%2Fcmake%2Fhelp%2Flatest%2Fvariable%2FCMAKE_FRAMEWORK_PATH.html%23variable%3ACMAKE_FRAMEWORK_PATH&data=02%7C01%7Cstephen.langer%40nist.gov%7C171ff2b34fed4f31b25808d60df864fd%7C2ab5d82fd8fa4797a93e054655c61dec%7C1%7C0%7C636711757824644817&sdata=03OJ9GGhZmzvIJjvHpZEWAFEEKzSXT0CJ6SM%2FSkUR5o%3D&reserved=0>
> ),
>
> 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/20180830/1c2e5835/attachment.html>
More information about the vtkusers
mailing list