[Newbies] Re: Differences in OpenGL support on Linux vs. OS X?

Bert Freudenberg bert at freudenbergs.de
Fri Jun 8 12:51:40 UTC 2012


(moving to beginners list)

On 07.06.2012, at 22:18, Phil (list) wrote:

> 
> Bert,
> 
> On Jun 7, 2012, at 6:25 AM, Bert Freudenberg wrote:
> 
>> 
>> This is probably unrelated, but you are apparently not using the latest OpenGL package, and you messed it up severely. Why is it using "B3DAcceleratorPlugin" instead of "libGL"?! I had to revert openGLLibraryName to make it work at all.
>> 
> 
> The short answer is that my work with OpenGL predated a lot of the discussion/documentation that's now available for Squeak and involved a lot of trial and error, so yes I'm considerably out of date and probably doing some screwy/wrong things and plan to correct that.
> 
> I *think* you identified my issue re: B3DAcceleratorPlugin.  When I initially tried to get the code running on Linux I was getting module not found errors and so I incorrectly did a search and replace to replace the module names (and accidentally went a little beyond that) which resulted in the appearance of OpenGL working on Ubuntu 12.04... and it sort of works (i.e. it's drawing but very poorly via B3D and I think I was/am getting confused re: internal vs. external plugins and how B3D fit into the mix with OpenGL.  I vaguely recall going down this path several years ago when I was attempting to initially get it running on OS X.)
> 
> Based on some further research on squeak-dev, the real issue appears to be my machines configuration (libGL isn't where the VM expects it)... and you're right, that's not a vm-dev issue but I do thank you for helping to point me in what appears to be the right direction to resolve this.
> 
> Now if none of what I've said makes sense, then I'm still lost but I'll take further discussion off of vm-dev.
> 
> Thanks,
> Phil

It does make sense. The way the OpenGL bindings work isn't entirely obvious, that's true.

What's happening is that in the moment you create an OpenGL object, the FFI methods are rewritten. The module you see in the source code is not the one that gets used. You can verify this by switching to see decompiled code.

The "openGLLibraryName" method tells the system which library to use (e.g. opengl32.dll on Windows, OpenGL.framework on OS X). On Unix, the default is "GL", which the VM expands to "libGL.so".

Now, while this works for Unix in general, it does not work for Linux, unless you install development libraries. E.g. on my Ubuntu system, where I did install "mesa-libGL-devel", I do have that symlink:

$ ll /usr/lib/i386-linux-gnu/mesa/
-rw-r--r--  1 root root     29 May 15 03:14 ld.so.conf
lrwxrwxrwx  1 root root     10 May 15 03:14 libGL.so -> libGL.so.1
lrwxrwxrwx  1 root root     12 May 15 03:14 libGL.so.1 -> libGL.so.1.2
-rw-r--r--  1 root root 358232 May 15 03:15 libGL.so.1.2

However, if you only install "mesa-libGL" and not the "-devel" package, you only have this:

$ ll /usr/lib/i386-linux-gnu/mesa/
-rw-r--r--  1 root root     29 May 15 03:14 ld.so.conf
lrwxrwxrwx  1 root root     12 May 15 03:14 libGL.so.1 -> libGL.so.1.2
-rw-r--r--  1 root root 358232 May 15 03:15 libGL.so.1.2

Therefore, to make it work on a user's Linux install, you have to make openGLLibraryName return "libGL.so.1".

Actually, I'm going to commit this right away ;)

Btw, B3DAcceleratorPlugin is just used for setting up an OpenGL context to render into. Since this is platform-dependent (in contrast to OpenGL itself) and needs VM integration, this part is a plugin and not done via FFI.

- Bert -




More information about the Beginners mailing list