On some modern Linux systems, Croquet does not work anymore because OpenGL failes to initialize. Now, I originally wrote that code, and it worked fine for years. So it can't possibly be buggy, right? Jens Lincke of impara tracked it down to the "Composite" extension that is enabled by default nowadays. With Composite disabled, it works, enable it, and it does not.
So I turned to NVIDIA for help, thinking their driver might be buggy. Had to give them an easy way to reproduce the problem, this is the snippet I came up with:
Anyway, NVIDIA could reproduce the problem, and found our bug:
So I turned to NVIDIA for help, thinking their driver might be buggy. Had to give them an easy way to reproduce the problem, this is the snippet I came up with:
Beauty, eh? ;-) I guess nobody has done this in a workspace for a long time. Stop it with Alt-.| ogl green |
ogl := OpenGL newIn: (0@0 extent: 100@100).
green := 1.
[[
ogl glClearColor(0, green, 0, 1).
ogl glClear(16r4000).
ogl swapBuffers.
Sensor waitClickButton.
green := 1 - green.
] repeat] ensure: [ogl destroy]
Anyway, NVIDIA could reproduce the problem, and found our bug:
[...] the app is trying to create a depth 24 child window of a depth 32 parent and the app specifies neither a border pixel nor a border pixmap.Doh! I forgot to specify the border! We were just lucky that this did not happen before. Jens and y.t. made a patch, should be in the next VM. And big thanks to NVIDIA developer support!
Comments
ogl glClearColor(0, green, 0, 1).
ogl glClear(16r4000).
...
I'm sure I don't get that. Most of the syntax here in the snippet looks like Smalltalk syntax. But then there's this mixed in? It's amazing, because immediately I have no idea what the glClearColor arguments mean. Or the glClear. Is this one of these "on beyond Smalltalk" things I keep hearing some of the spring-from-Squeak projects talking about?
The reason is that this is the syntax that is used in any piece of OpenGL documentation. You can alternatively write
ogl glClearColor: 0 with: green with: 0 with: 1
which I find even less readable. These are FFI methods, so they directly call out to the corresponding C function. Personally I like this, it reminds me that this is a C call rather than a Smalltalk method.
A "cool" hack is to use cascades, which allows you to copy C code almost verbatim:
ogl
glClearColor(0, green, 0, 1);
glClear(16r4000);
yourself.
Besides, you might find this useful: COpenGLPlayer