Re: osmesa and lighting

Bram Biesbrouck <[email protected]> Wed, 22 Mar 2006 09:29:24 -0800
Newsgroups gmane.games.devel.opengl
Organization Fat City Network Services, San Diego, California
Message-ID <[email protected]>
I've solved the problem (special thanks to Kent Quirk). It was two-fold:
The specular value of the model was indeed different in both screenshots 
(actually, there was something wrong with it under QGL), and on top of that,
the diffuse function 
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA)

produced very different results for both contexts.The OpenGL manual says 
"blending arithmetic is not exactly specified", so I should have known that 
could be a problem.
I changed the function to:
glBlendFunc(GL_SRC_ALPHA,GL_SRC_ALPHA)

This produces a nearly identical render for both contexts (although osmesa is 
still slightly darker).

Anyway, thanks to the people that helped me out.

Bram

Op woensdag 22 maart 2006 17:54, schreef Saurabh:
> i've no idea how osmesa works, but  i've seen the screenshot, and ithink
> that u might want to change the specular component of theballoon to the
> same colour as the ambient/diffuse of that material.tell me if this works.
> On 3/21/06, Bram Biesbrouck <[email protected]> wrote:> 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 REM!
> OVE 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).> -----
> FAQ and OpenGL Resources at:
>   http://www.geocities.com/SiliconValley/Hills/9956/OpenGL
----- 
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).