Ok, I’m fairly new to OGL, but I’ve done alright so far. I’m developing some software that represents some tables of data in 3d graph format. The code are fairly basic, and nothing is terribly complex about the graphs.
In developing it, I’ve gotten nearly everything to work, however, I seem to have some lighting issues that manifest themselves on two machines here.
They both have different ATI cards, tho I did not enable accelleration in the pixel format descriptor(enabling it doesn’t fix the problem either). I’m not sure how that really works, as the OpenGL dll still seems to be an ATI supplied file.
Otherwise, I have it working on 2 machines with Nvidia cards and a machine with no hardware accelleration at all.
Basically, the problem is that on the ATI machines, the scene appears to lack the positional light I have set up and works on all the other machines I’ve tested. If you move the camera position to exactly where the light is positioned, the scene looks correct. Removing or altering the specular lighting components of the material and the light don’t seem to have any effect.
It appears almost as if the normals of every vertex are all equal as rotating the object changes the intensity of all points equally(even tho the points all have different normals).
I’ve traced thru the code and I can see that I am setting the normals how I want, but they just don’t seem to take effect unless I am in line with the light.
Has anyone experienced this or does anyone have any guesses on what I can check.
Here is my lighting initialization
GLfloat lightPos[]={4.0f, -2.0f, 4.0f, 0.0f}; // set light position
glLightfv(GL_LIGHT0, GL_POSITION, lightPos);
GLfloat diffuseLight[]={0.8f, 0.8f, 0.8f, 1.0f}; // set diffuse light parameters
glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuseLight);
GLfloat ambientLight[]={0.2f, 0.2f, 0.2f, 1.0f}; // set ambient light parameters
glLightfv(GL_LIGHT0, GL_AMBIENT, ambientLight);
GLfloat specularLight[]={0.6f, 0.6f, 0.6f, 1.0f}; // set specular light parameters
glLightfv(GL_LIGHT0, GL_SPECULAR, specularLight);
glLightModelfv(GL_LIGHT_MODEL_AMBIENT, ambientLight); // set light model
GLfloat specularReflection[]={0.8f, 0.8f, 0.8f, 1.0f}; // set specularity
glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, specularReflection);
glMateriali(GL_FRONT_AND_BACK, GL_SHININESS, 128);
glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, diffuseLight);
glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, ambientLight);
glEnable(GL_LIGHT0); // activate light0
glEnable(GL_LIGHTING); // enable lighting
glEnable(GL_NORMALIZE);
Here is the basic code that is looped through to build my display list
if(_GenerateNormal(u, v, w, normal))
glNormal3fv(normal);
refuColor = _GetCellColor(*(zIter + 1));
fvuColor[0] = GetRValue(refuColor)/(float)0xFF;
fvuColor[1] = GetGValue(refuColor)/(float)0xFF;
fvuColor[2] = GetBValue(refuColor)/(float)0xFF;
glColor3fv(fvuColor);
glVertex3fv(u);
_GenerateNormal, btw returns true if lighting is enabled and populates my normal array w/ an un-unit-vectorized normal, and I let OGL handle the unit-vector conversion.
Wow, that got long.
Anyway, any help at all would be appreciated. Thanks!