[vtkusers] vtk getting wrong OpenGL version number from mesa and macports

Langer, Stephen A. (Fed) stephen.langer at nist.gov
Tue Jan 30 17:13:31 EST 2018


I think that macports' xorg-server port is supposed to be the same as xquartz, but I downloaded xquartz to see what was in it, and I does provide glx.h while xorg-server does not.   For simplicity (hah!) I'd like to keep as much as possible of the installation within macports, so I'd rather not install xquartz.  Perhaps I'll have to give up on that.

-- Steve

On 1/29/18, 11:16 PM, "David Gobbi" <david.gobbi at gmail.com<mailto:david.gobbi at gmail.com>> wrote:

Hmm, I just checked and /usr/X11R6 is just a symlink to /opt/X11, so the latter is probably the better place to look.

On Mon, Jan 29, 2018 at 8:33 PM, David Gobbi <david.gobbi at gmail.com<mailto:david.gobbi at gmail.com>> wrote:
Hi Steve,

If you install xquartz, you should see glx.h in /usr/X11R6/include.  On OS X, X11 always had its own GL headers and libraries inside /usr/X11R6/include and /usr/X11R6/lib.  You'd definitely have to link to those libraries, rather than linking to OpenGL.framework.

I remember that VTK-X11 on OS X was a well-supported configuration back in 2005 or so.

 - David


On Mon, Jan 29, 2018 at 8:06 PM, Langer, Stephen A. (Fed) <stephen.langer at nist.gov<mailto:stephen.langer at nist.gov>> wrote:
OSX does come with OpenGL, but not the X11 parts of it.  There's no glx.h in /System/Library/Frameworks/OpenGL.framework/Headers, and the libraries don't define glXChooseFBConfig and other symbols used by VTK.

Just firing up ccmake and not making any changes to the configuration gives VTK_USE_X=OFF and VTK_USE_COCOA=ON, but I want them the other way around.  Changing those two settings but nothing else makes it try to link to the OpenGL.framework, and the build fails because the framework doesn't support X11.   Pointing OPENGL_INCLUDE_DIR, OPENGL_gl_LIBRARY, and OPENGL_glu_LIBRARY to the mesa components lets VTK build, but it gives a warning at run time when it checks the OpenGL version, and then crashes.

The reason for doing this is that many (most?) ports in macports use X11 instead of Cocoa/Quartz, and it's difficult to mix the two.  Our software will be easier to distribute if it can be built to use either X11 or Cocoa.   Also, we're using gtk2, and it works better in X11.  (Someday we'll upgrade to gtk3…)

-- Steve

From: Ken Martin <ken.martin at kitware.com<mailto:ken.martin at kitware.com>>
Date: Monday, January 29, 2018 at 3:21 PM
To: "Langer, Stephen A. (Fed)" <stephen.langer at nist.gov<mailto:stephen.langer at nist.gov>>
Cc: "vtkusers at vtk.org<mailto:vtkusers at vtk.org>" <vtkusers at vtk.org<mailto:vtkusers at vtk.org>>
Subject: Re: [vtkusers] vtk getting wrong OpenGL version number from mesa and macports

I'm pretty sure OSX comes with OpenGL and OSX always provides at least OpenGL 3.2 as of any version of OSX in the past few years. I'm not an OSX wizard, but generally default vtk builds straight out of the box last I checked. Maybe try a clean VTK build using all the defaults and see if that works.

On Mon, Jan 29, 2018 at 3:08 PM, Langer, Stephen A. (Fed) <stephen.langer at nist.gov<mailto:stephen.langer at nist.gov>> wrote:
Hi --

I'm revisiting earler efforts to get vtk working with X11 on macOS.  I'd been building vtk with Cocoa because with X11 vtk was complaining that it couldn't find OpenGL version 3.2 or later.  I'm using macports to install OpenGL (mesa), and supposedly it's providing version 4.5 of OpenGL.

I've tried building vtk both with and without VTK_USE_SYSTEM_GLEW, since vtk gets the version number from glew.  I tried tracing though the process of getting the version number, starting with vtkOpenGLRenderWindow::OpenGLInitContext(), but found the glew code to be amazingly opaque.   All I know for sure is that in vtk's OpenGLInitContext, GLEW_VERSION_3_2 and GLEW_VERSION_3_1 are empty, but the glew source code *does* set them, in glewContextInit() in glew.c.  I don't know what it sets them *to*, though.

I'm using the latest vtk from git master, but the problem occurred with released versions too.

I don't know if this is a vtk problem or a macports problem or a mesa problem, but I didn't get a helpful answer from the macports list.  Any advice would be much appreciated.

Thanks.

 -- Steve

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://vtk.org/pipermail/vtkusers/attachments/20180130/25eda1b8/attachment.html>


More information about the vtkusers mailing list