[Plib-users] Weird problem
Brought to you by:
sjbaker
From: Marco B. <F1...@so...> - 2002-11-16 11:43:35
|
Hi! I'm using PLIB successfully for my space combat game. I have my GUI/HUD system that I wrote some time ago and it was easy to make live them together because my GUI is written in OpenGL too. I use two functions to start/end the 2D rendering, like this: ssgCullAndDraw(pWorld); Begin2D(); // ... all my GUI/HUD stuff End2D(); All works fine. In Begin2D() I simply glEnable/glDisable some OpenGL states and setup the Ortho projection. Here's the problem: yesterday I tried to use ssgaLensFlare and it works, but when the lens flares are visible my 2D system draws the texture in the wrong way. It's like the ssgaLensFlare changes some OpenGL state that I don't enable/disable in the Begin2D()... I looked plib sources but you set only GL_BLEND and AlphaFunc in ssgaLensFlare and re-set them so it's not the problem. What could it be? I post here my Begin2D() and End2D() code: void Begin2D(int iWidth, int iHeight) { glDisable ( GL_LIGHTING ) ; glEnable ( GL_TEXTURE_2D ) ; glDisable ( GL_DEPTH_TEST ) ; glDisable ( GL_CULL_FACE ) ; glEnable ( GL_ALPHA_TEST ) ; glEnable ( GL_BLEND ) ; glAlphaFunc ( GL_GREATER, 0.1f ) ; glBlendFunc ( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ) ; //create an projection that acts like a 2D screen glMatrixMode ( GL_PROJECTION ) ; glPushMatrix () ; glLoadIdentity () ; glOrtho(0, iWidth, iHeight, 0, -1, 1); glMatrixMode ( GL_MODELVIEW ) ; glPushMatrix () ; glLoadIdentity () ; } void End2D() { glMatrixMode ( GL_PROJECTION ) ; glPopMatrix () ; glMatrixMode ( GL_MODELVIEW ) ; glPopMatrix () ; glEnable(GL_LIGHTING); glEnable(GL_DEPTH_TEST); glEnable(GL_CULL_FACE); glDisable ( GL_ALPHA_TEST ) ; glDisable ( GL_BLEND ) ; glAlphaFunc ( GL_ALWAYS, 0.0 ) ; glBlendFunc ( GL_ONE, GL_ZERO ) ; } Sorry for my bad english... but hope to have been clear enough. Thank you! Bye Bye F104/NA |