[OpenSCAD] Light source and default camera position different on command line

Marius Kintel marius at kintel.net
Fri Sep 14 22:20:21 EDT 2018

> On Sep 10, 2018, at 8:47 AM, nop head <nop.head at gmail.com> wrote:
> But the lighting code is already the same for both cameras. I don't understand why it comes out different. Are the lighting positions relative to the world or the camera?
The two cameras have slightly different ways of managing OpenGL matrices (https://github.com/openscad/openscad/blob/master/src/GLView.cc#L91):
* The gimbal camera sets up the camera parameters in GL_PROJECTION mode, then resets the MODELVIEW matrix and rotates the scene
* The vector camera set up the camera projection in GL_PROJECTION mode, then does a gluLookat().

Without looking at this in great detail, I’d guess that the gimbal mode is messing with stuff it shouldn’t do with the PROJECTION matrix, causing the lights to have different relative directions in gimbal and vector modes.

Setting up OpenGL cameras and lights using these low-level functions can be tricky and is error prone...


More information about the Discuss mailing list