PDA

View Full Version : Radeon GL_NORMALIZE bugged ?



bzarokian
05-27-2002, 01:53 AM
Am I dreaming, or is the Radeon drivers GL_NORMALIZE directive implementation faulty ? Seems to me that it makes the normals 1.1-1.2 long and sometimes invert their directions (!!!). Messes up the specular reflections quite a lot.
This bug shows up every time on any Radeon board (different systems, OSes ...), on all my programs using GL_NORMALIZE which have been working fine for years on any cards of any brands (and on software implementations as well). Am I missing something ?

Humus
05-27-2002, 02:10 AM
if only the Radeon has the problem then it's most likely a bug. Mail devrel@ati.com about it.

bzarokian
05-27-2002, 06:45 AM
Some precisions : the bug shows up when enabling GL_NORMALIZE with infinitely distant lights and only on the specular lighting (doesn't appear on the right side, saturated).
Sample code on request.

zeckensack
05-27-2002, 02:08 PM
Originally posted by bzarokian:
Some precisions : the bug shows up when enabling GL_NORMALIZE with infinitely distant lights and only on the specular lighting (doesn't appear on the right side, saturated).
Sample code on request.Request http://www.opengl.org/discussion_boards/ubb/smile.gif

bzarokian
05-28-2002, 01:26 AM
Here it is :



#include <windows.h>
#include <GL/gl.h>
#include <GL/glu.h>
#include <GL/glut.h> // Or anywhere else

void keyboardproc(unsigned char key,int x,int y){
switch (key){
case '0':
glEnable(GL_NORMALIZE);
OutputDebugString("1");
break;
case '1':
glDisable(GL_NORMALIZE);
OutputDebugString("2");
break;
case '2':
glLightModelf(GL_LIGHT_MODEL_TWO_SIDE, 1);
OutputDebugString("3");
break;
case '3':
glLightModelf(GL_LIGHT_MODEL_TWO_SIDE, 0);
OutputDebugString("4");
break;
case 27:
exit(0);
break;
}
glutPostRedisplay();
}

void menu(int item){
keyboardproc(item,0,0);
}

void DisplayFrame(void){
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
glPushMatrix();
glTranslatef(0,0,-5);
glutSolidSphere(1.5,100,100);
glFlush();
glPopMatrix();
glutSwapBuffers();
}

void initializeGL(){
GLfloat light_ambient[] ={ 0.0, 0.0, 0.0, 1.0 };
GLfloat light_diffuse[] ={ 0.7, 0.7, 0.7, 1.0 };
GLfloat light_specular[] ={ 1.0, 1.0, 1.0, 1.0 };
GLfloat light_position[] ={ 1.0, 0.0, 1.0, 0.0 };

GLfloat light_ambient1[] ={ 0.0, 0.0, 0.0, 1.0 };
GLfloat light_diffuse1[] ={ 0.7, 0.7, 0.7, 1.0 };
GLfloat light_specular1[] ={ 1.0, 1.0, 1.0, 1.0 };
GLfloat light_position1[] ={-1.0, 1.0, 0.0, 0.0 };

GLfloat mat_ambient[] ={ 0.1, 0.1, 0.1, 1.0 };
GLfloat mat_diffuse[] ={ 0.7, 0.7, 0.1, 1.0 };
GLfloat mat_specular[] ={ 1.0, 1.0, 1.0, 1.0 };

glLightfv(GL_LIGHT0,GL_AMBIENT, light_ambient);
glLightfv(GL_LIGHT0,GL_DIFFUSE, light_diffuse);
glLightfv(GL_LIGHT0,GL_SPECULAR,light_specular);
glLightfv(GL_LIGHT0,GL_POSITION,light_position);

glLightfv(GL_LIGHT1,GL_AMBIENT, light_ambient1);
glLightfv(GL_LIGHT1,GL_DIFFUSE, light_diffuse1);
glLightfv(GL_LIGHT1,GL_SPECULAR,light_specular1);
glLightfv(GL_LIGHT1,GL_POSITION,light_position1);

glMaterialfv(GL_FRONT_AND_BACK,GL_AMBIENT ,mat_ambient);
glMaterialfv(GL_FRONT_AND_BACK,GL_DIFFUSE ,mat_diffuse);
glMaterialfv(GL_FRONT_AND_BACK,GL_SPECULAR,mat_spe cular);
glMateriali(GL_FRONT_AND_BACK,GL_SHININESS,80);

glEnable(GL_LIGHTING);
glEnable(GL_LIGHT1);
glEnable(GL_LIGHT0);

glLightModelf(GL_LIGHT_MODEL_LOCAL_VIEWER, 0);
glEnable(GL_DEPTH_TEST);
glFrontFace(GL_CCW);
glShadeModel(GL_SMOOTH);
}

void resize(int width,int height){
glViewport(0, 0, width, height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(50.0, (GLfloat) width/(GLfloat) height, 1.0, 20.0);
glMatrixMode(GL_MODELVIEW);
}

void main(int argc,char** argv){
glutInitWindowSize(600, 600);
glutInit(&amp;argc, argv);
glutInitDisplayMode(GLUT_RGBA | GLUT_DEPTH | GLUT_DOUBLE);
glutCreateWindow("Right-click for menu");
glutReshapeFunc(resize);
glutDisplayFunc(DisplayFrame);
glutKeyboardFunc(keyboardproc);
glutCreateMenu(menu);
glutAddMenuEntry("Radeon GL_NORMALIZE test", 0);
glutAddMenuEntry("", 0);
glutAddMenuEntry("[0] - GL_NORMALIZE ON",'0');
glutAddMenuEntry("[1] - GL_NORMALIZE OFF",'1');
glutAddMenuEntry("[2] - Two sides lighting",'2');
glutAddMenuEntry("[3] - Front side lighting",'3');
glutAddMenuEntry("", 0);
glutAddMenuEntry("[ESC] Quit", 27);
glutAttachMenu(GLUT_RIGHT_BUTTON);
initializeGL();
glutMainLoop();
}

gavinb
05-29-2002, 05:26 PM
I don't use GL_NORMALIZE but I am also running into problems with the specular reflection being messed up on radeon cards. I am using the seperate specular color extention.

marginal_warfare
05-30-2002, 11:43 AM
I haven't run into this problem (developing on a Radeon and a Geforce 3) - maybe it's a driver issue?

What operating system are you using? (my radeon development box runs Linux)