Experiments with OpenGL 2.0 on OS X
Posted: 04.01.2006, 09:11
Anyone who has recently tried Celestia on OS X 10.4.3 (and possibly only on recent video cards) will have noticed that the OpenGL 2.0 render path is now selectable, but gives horribly incorrect rendering.
Since the PC and Linux versions render splendidly (for the most part), this is obviously a bug in Apple's GLSL driver code. So I spent the afternoon copying and pasting Celestia's generated GLSL shader code from /tmp/celestia-shaders.log into Apple's OpenGL Shader Builder. With some experimentation, I think I may have pinned down the issue. Here're test renderings of Saturn's ring shadow with a modified version of Celestia's GLSL code:
Smooth-edged ring shadows are a hallmark of the OGL2 render path. Compare it to the Vertex Program path:
I am pretty sure that Apple's GLSL driver code does not interpret structs, or at least uniform structs correctly. As Celestia declares lights using uniform structs (this is 100% ok by the way), this was why previously the GL 2.0 path did not render lighting properly.
The screenshots substitute gl_LightSource[i] for all uses of the light struct. This is incorrect so the lighting direction is off, etc, but it does demonstrate that the light struct was not being recognized properly before. This is enough info I think to file a detailed bug report with Apple.
Since the PC and Linux versions render splendidly (for the most part), this is obviously a bug in Apple's GLSL driver code. So I spent the afternoon copying and pasting Celestia's generated GLSL shader code from /tmp/celestia-shaders.log into Apple's OpenGL Shader Builder. With some experimentation, I think I may have pinned down the issue. Here're test renderings of Saturn's ring shadow with a modified version of Celestia's GLSL code:
Smooth-edged ring shadows are a hallmark of the OGL2 render path. Compare it to the Vertex Program path:
I am pretty sure that Apple's GLSL driver code does not interpret structs, or at least uniform structs correctly. As Celestia declares lights using uniform structs (this is 100% ok by the way), this was why previously the GL 2.0 path did not render lighting properly.
The screenshots substitute gl_LightSource[i] for all uses of the light struct. This is incorrect so the lighting direction is off, etc, but it does demonstrate that the light struct was not being recognized properly before. This is enough info I think to file a detailed bug report with Apple.