LWJGL
May 20, 2012, 23:42:04 *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: LWJGL 2.8.3 released!
 
   Home   Help Search Login Register  



Pages: [1]
  Print  
Author Topic: Blinking problems when fog is enabled  (Read 2535 times)
Worgle
Newbie
*
Posts: 2


« on: August 01, 2006, 07:58:40 »

Hello,

I've got some problems when using fog in my program.
I display a cube (with LWJGL) which is rotating on the screen. Without fog : no problems. But when I turn the fog on, the cube's faces suddenly "blink".

I was thinking about a double buffer problem but apprently double buffer is by default enabled with LWJGL and moreover I've got no probem without the fog.

If someone have an idea...

Here's some snippet of my code :

Code:

   glEnable(GL_DEPTH_TEST);
   glEnable(GL_BLEND);
   //If I coment this line, no problem appears
   glEnable(GL_FOG);


Code:

 glViewport(0,0,800,600);
 glMatrixMode(GL_PROJECTION);
 glLoadIdentity();
 gluPerspective(45.0f,(float) 800/600,1.f,1000.f);
 gluLookAt(400,400,400,100,100,100,0,1,0);


MAIN LOOP :
Code:

 
  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
  yAngleCube+=0.1f%360.f;
     glMatrixMode(GL_MODELVIEW);
     glPushMatrix(); //SAUVE la matrice actuelle
     glRotatef(yAngleCube, 0.f, 1.f, 0.f );
//Cube
glBegin(GL_QUADS);
   glColor3f(0.0f, 1.0f, 1.0f);
   glVertex3f(0.0f, 0.0f, 0.0f);
   glVertex3f(200.0f, 0.0f, 0.0f);
   glVertex3f(200.0f, 200.0f, 0.0f);
   glVertex3f(0.0f, 200.0f, 0.0f);//face sur le plan z=0

   glColor3f(1.0f, 1.0f, 0.0f);
   glVertex3f(0.0f, 0.0f, 0.0f);
   glVertex3f(0.0f, 200.0f, 0.0f);
   glVertex3f(0.0f, 200.0f, 200.0f);
   glVertex3f(0.0f, 0.0f, 200.0f);//face sur le plan x=0

   glColor3f(1.0f, 0.0f, 1.0f);
   glVertex3f(0.0f, 0.0f, 0.0f);
   glVertex3f(200.0f, 0.0f, 0.0f);
   glVertex3f(200.0f, 0.0f, 200.0f);
   glVertex3f(0.0f, 0.0f, 200.0f);//face sur le plan y=0

   glColor4f(0.0f, 0.0f, 1.0f,0.8f); //face transparente !!
   glVertex3f(0.0f, 0.0f, 200.0f);
   glVertex3f(200.0f, 0.0f, 200.0f);
   glVertex3f(200.0f, 200.0f, 200.0f);
   glVertex3f(0.0f, 200.0f, 200.0f);//face sur le plan z=200      
 
   glColor3f(1.0f, 0.0f, 0.0f);
   glVertex3f(200.0f, 0.0f, 0.0f);
   glVertex3f(200.0f, 200.0f, 0.0f);
   glVertex3f(200.0f, 200.0f, 200.0f);
   glVertex3f(200.0f, 0.0f, 200.0f);//face sur le plan x=200
   
   glColor3f(0.0f, 1.0f, 0.0f);
   glNormal3f(0.f,-1.0f,0.0f);
   glVertex3f(0.0f, 200.0f, 0.0f);
   glVertex3f(200.0f, 200.0f, 0.0f);
   glVertex3f(200.0f, 200.0f, 200.0f);
   glVertex3f(0.0f, 200.0f, 200.0f);//face sur le plan y=200
glEnd();

     glPopMatrix(); //restore la matrice
     
  //actualisation de l'affichage
  Display.update();


Le Worgle

PS : I'm french, sorry for my bad english...
Logged
Worgle
Newbie
*
Posts: 2


« Reply #1 on: August 01, 2006, 08:09:59 »

Here's a little image to explain.



I've just seen that I posted in the wrong place, it must be in "OpenGL" part of the forum. If there an admin to move the post... Sorry :s

Le Worgle
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines
SMFAds for Free Forums
Valid XHTML 1.0! Valid CSS!