PDA

View Full Version : Different lighting in GF-Cards than on TNTs?



The_V|k|ng
09-02-2002, 04:07 AM
Heya dudes!

I recently upgraded my PC with a Geforce4 Ti4200. Starting my little OGL program that i am working on, I realized that all my models were pitch black. They were drawn properly with textures and all when I had lighting disabled, but lighting is a useful thing to have. Besides, it worked all fine when I still had my old TNT2.
My code looks like this:
void CSpaceShip::Render ()
{
unsigned char i;
switch (State) {
case SS_DESTROYED: break;
default:
glEnable (GL_DEPTH_TEST);
glEnable (GL_LIGHTING);
glPushMatrix ();
glTranslatef (Position.values[0],
Position.values[1],
Position.values[2]);
glRotatef (Rad2Deg(OrientationAngle), 0.0, 1.0, 0.0);
glCallList (ModelDisplayList);
glPopMatrix ();
break;
}
}

So, where's the difference? Has someone had the same problems and a solution to this? Any sort of hint is appreciated! Thanx in advance!

Regards,
The_V|k|ng

V66ras
09-02-2002, 04:39 AM
Can't see where you specify your lights.

The_V|k|ng
09-02-2002, 06:33 AM
First of all, thanx for your rely! :-)
Sorry, the lights are not in that function, I just thought that I had to set some state I didnt yet know to solve this prob. My lights are specified like this:

float CameraDistance = 100.0,
CameraAngle = 30*PI/180;
GLfloat LightAmbient[]= { 1.0, 1.0, 1.0, 1.0 };
GLfloat LightDiffuse[]= { 1.0, 1.0, 1.0, 1.0 };
GLfloat LightSpecular[]= { 1.0, 1.0, 1.0, 1.0 };

void init(void)
{
[...] (other non-GL stuff)
static GLfloat LightPos[] = {0,CameraDistance*cos(CameraAngle), CameraDistance*sin(CameraAngle)};
glLightfv(GL_LIGHT0, GL_AMBIENT,LightAmbient);
glLightfv(GL_LIGHT0, GL_DIFFUSE,LightDiffuse);
glLightfv(GL_LIGHT0,GL_SPECULAR,LightSpecular);
glLightfv (GL_LIGHT0, GL_POSITION, LightPos);
glEnable (GL_LIGHTING);
glEnable (GL_LIGHT0);
[...] (still other non-GL stuff)
}

I dont think that the error is in the lights code, though, for it had been working with my TNT2 and I didnt change a thing except my graphics card. Or maybe I am missing some Gf4-related issues?
I'd just like the models to look like they do in Milkshape, nice and bright, and not some almost-black.
So, hope that helps you so you can help me...
Thanx again!

Regards,
The_V|k|ng