osmesa and lighting

Bram Biesbrouck <[email protected]> Tue, 21 Mar 2006 08:39:25 -0800
Newsgroups gmane.games.devel.opengl
Organization Fat City Network Services, San Diego, California
Message-ID <[email protected]>
Hi all,

I've been fighting with an OpenGL issue for two days straight now and you're 
my final resort, please help me out.
I'm "porting" an QT-application (on Linux) that uses OpenGL (QGLWidget) 
extensively to a batch-renderer, using osmesa(32). It all works out fine, 
except for the lighting.

To illustrate my problem, please take a look at 
http://bisousucre.com/screenshots.png

On the left, you see a rendering of my QT-application, on the right, the exact 
same code, using osmesa instead of QGLWidget. Obviously, there's something 
wrong with the lighting on osmesa, but I really can't figure out what it is!

The textballoon you see uses the following settings:
----initGL()-----
   glViewport(0, 0, (GLsizei) 800, (GLsizei) 600);
   glMatrixMode(GL_PROJECTION);
   glLoadIdentity();
   glOrtho(0.0, (GLdouble) 800, 0.0, (GLdouble) 600, -1000, 1000);
   glMatrixMode(GL_MODELVIEW);
   glLoadIdentity();

    //for transparency-support
    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
    //set-up lighting
    glEnable(GL_LIGHTING);
    glEnable(GL_LIGHT0);
    //recalculate the surface-normals if we scale
    glEnable(GL_NORMALIZE);

-----display()-----
    glEnable(GL_DEPTH_TEST);
    glEnable(GL_CULL_FACE);
    glEnable(GL_BLEND);

Since both codebases (QT and osmesa) are practically the same, I assume 
QGLContext  does some additional initialisation that makes the light to 
diffuse a lot more. However, I printed out all settings of GL_LIGHT0 and they 
were the same for both cases.

If anyone sees something obvious (or far less obvious) that I am missing, or 
needs some additional info or testing, please tell/ask me.

thanks,

Bram
----- 
FAQ and OpenGL Resources at:
  http://www.geocities.com/SiliconValley/Hills/9956/OpenGL

-- 
Author: Bram Biesbrouck
  INET: [email protected]

Fat City Hosting, San Diego, California -- http://www.fatcity.com
---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [email protected] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB OPENGL-GAMEDEV-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).