Jump to content
  • Advertisement
Sign in to follow this  
eGamer

ATI directional light problem

This topic is 4879 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

i have a 32-ATI Graphics Card,i get a runtime error when i use directional lighting in my program. the same program works fine on GeForce Cards. What is the Problem ?

Share this post


Link to post
Share on other sites
Advertisement
the program was written with openGL,anyway if i have broken
something then why it worked fine on Geforce Cards ?

Share this post


Link to post
Share on other sites
Quote:
Original post by eGamer
anyway if i have broken something then why it worked fine on Geforce Cards ?


because NV cards tend to be more forgiving of programmer error than ATI cards and something as simple as a problem with the directional lighting would have been spotted by now.

also, it was the best reply I could give given the lack of infomation provided by yourself

Share this post


Link to post
Share on other sites
here is the code that caused the problem:

float ambient[] = {1.0f,1.0f,1.0f};
float diffuse[] = {1.0f,1.0f,1.0f};
float position[]= {0,80,0,0};

int DrawGLScene(GLvoid) // Here's Where We Do All The Drawing
{
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); // Clear Screen And Depth Buffer
glLoadIdentity(); // Reset The Current Modelview Matrix

glTranslated(0,0,-10);

static float yRot = 0;
glRotated(yRot,0,1,0);
glRotated(yRot-0.5,1,0,0);
glRotated(yRot-0.3,0,0,1);

yRot++;

glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);

glLightfv(GL_LIGHT0,GL_AMBIENT,ambient);
glLightfv(GL_LIGHT0,GL_DIFFUSE,diffuse);
glLightfv(GL_LIGHT0,GL_POSITION,position);

glBegin(GL_QUADS);
// front facing polygon : counter clockwise
// up face
glNormal3d(0,1,0);glVertex3d(-1,2, 1);
glNormal3d(0,1,0);glVertex3d(+1,2, 1);
glNormal3d(0,1,0);glVertex3d(+1,2,-1);

glNormal3d(0,1,0);glVertex3d(-1,2, 1);
glNormal3d(0,1,0);glVertex3d(+1,2,-1);
glNormal3d(0,1,0);glVertex3d(-1,2,-1);

// front face
glNormal3d(0,0,1);glVertex3d(-1,0,1);
glNormal3d(0,0,1);glVertex3d(+1,0,1);
glNormal3d(0,0,1);glVertex3d(+1,2,1);

glNormal3d(0,0,1);glVertex3d(-1,0,1);
glNormal3d(0,0,1);glVertex3d(+1,2,1);
glNormal3d(0,0,1);glVertex3d(-1,2,1);

// right face
glNormal3d(1,0,0);glVertex3d(+1,0,+1);
glNormal3d(1,0,0);glVertex3d(+1,0,-1);
glNormal3d(1,0,0);glVertex3d(+1,2,-1);

glNormal3d(1,0,0);glVertex3d(+1,0,+1);
glNormal3d(1,0,0);glVertex3d(+1,2,-1);
glNormal3d(1,0,0);glVertex3d(+1,2,+1);


// left face
glNormal3d(-1,0,0);glVertex3d(-1,0,+1);
glNormal3d(-1,0,0);glVertex3d(-1,2,+1);
glNormal3d(-1,0,0);glVertex3d(-1,2,-1);

glNormal3d(-1,0,0);glVertex3d(-1,0,+1);
glNormal3d(-1,0,0);glVertex3d(-1,2,-1);
glNormal3d(-1,0,0);glVertex3d(-1,0,-1);


// back face
glNormal3d(0,0,1);glVertex3d(-1,0,-1);
glNormal3d(0,0,1);glVertex3d(-1,2,-1);
glNormal3d(0,0,1);glVertex3d(+1,2,-1);

glNormal3d(0,0,1);glVertex3d(-1,0,-1);
glNormal3d(0,0,1);glVertex3d(+1,2,-1);
glNormal3d(0,0,1);glVertex3d(+1,0,-1);


// down face
glNormal3d(0,-1,0);glVertex3d(-1,0,+1);
glNormal3d(0,-1,0);glVertex3d(-1,0,-1);
glNormal3d(0,-1,0);glVertex3d(+1,0,-1);

glNormal3d(0,-1,0);glVertex3d(-1,0,+1);
glNormal3d(0,-1,0);glVertex3d(+1,0,-1);
glNormal3d(0,-1,0);glVertex3d(+1,0,+1);
glEnd();

return TRUE;
}



[Edited by - evolutional on June 15, 2005 6:37:55 AM]

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Quote:
Original post by _the_phantom_
Quote:
Original post by eGamer
anyway if i have broken something then why it worked fine on Geforce Cards ?


because NV cards tend to be more forgiving of programmer error than ATI cards and something as simple as a problem with the directional lighting would have been spotted by now.

also, it was the best reply I could give given the lack of infomation provided by yourself




here is the code that caused the problem:

float ambient[] = {1.0f,1.0f,1.0f};
float diffuse[] = {1.0f,1.0f,1.0f};
float position[]= {0,80,0,0};

int DrawGLScene(GLvoid) // Here's Where We Do All The Drawing
{
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); // Clear Screen And Depth Buffer
glLoadIdentity(); // Reset The Current Modelview Matrix

glTranslated(0,0,-10);

static float yRot = 0;
glRotated(yRot,0,1,0);
glRotated(yRot-0.5,1,0,0);
glRotated(yRot-0.3,0,0,1);

yRot++;

glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);

glLightfv(GL_LIGHT0,GL_AMBIENT,ambient);
glLightfv(GL_LIGHT0,GL_DIFFUSE,diffuse);
glLightfv(GL_LIGHT0,GL_POSITION,position);

glBegin(GL_QUADS);
// front facing polygon : counter clockwise
// up face
glNormal3d(0,1,0);glVertex3d(-1,2, 1);
glNormal3d(0,1,0);glVertex3d(+1,2, 1);
glNormal3d(0,1,0);glVertex3d(+1,2,-1);

glNormal3d(0,1,0);glVertex3d(-1,2, 1);
glNormal3d(0,1,0);glVertex3d(+1,2,-1);
glNormal3d(0,1,0);glVertex3d(-1,2,-1);

// front face
glNormal3d(0,0,1);glVertex3d(-1,0,1);
glNormal3d(0,0,1);glVertex3d(+1,0,1);
glNormal3d(0,0,1);glVertex3d(+1,2,1);

glNormal3d(0,0,1);glVertex3d(-1,0,1);
glNormal3d(0,0,1);glVertex3d(+1,2,1);
glNormal3d(0,0,1);glVertex3d(-1,2,1);

// right face
glNormal3d(1,0,0);glVertex3d(+1,0,+1);
glNormal3d(1,0,0);glVertex3d(+1,0,-1);
glNormal3d(1,0,0);glVertex3d(+1,2,-1);

glNormal3d(1,0,0);glVertex3d(+1,0,+1);
glNormal3d(1,0,0);glVertex3d(+1,2,-1);
glNormal3d(1,0,0);glVertex3d(+1,2,+1);


// left face
glNormal3d(-1,0,0);glVertex3d(-1,0,+1);
glNormal3d(-1,0,0);glVertex3d(-1,2,+1);
glNormal3d(-1,0,0);glVertex3d(-1,2,-1);

glNormal3d(-1,0,0);glVertex3d(-1,0,+1);
glNormal3d(-1,0,0);glVertex3d(-1,2,-1);
glNormal3d(-1,0,0);glVertex3d(-1,0,-1);


// back face
glNormal3d(0,0,1);glVertex3d(-1,0,-1);
glNormal3d(0,0,1);glVertex3d(-1,2,-1);
glNormal3d(0,0,1);glVertex3d(+1,2,-1);

glNormal3d(0,0,1);glVertex3d(-1,0,-1);
glNormal3d(0,0,1);glVertex3d(+1,2,-1);
glNormal3d(0,0,1);glVertex3d(+1,0,-1);


// down face
glNormal3d(0,-1,0);glVertex3d(-1,0,+1);
glNormal3d(0,-1,0);glVertex3d(-1,0,-1);
glNormal3d(0,-1,0);glVertex3d(+1,0,-1);

glNormal3d(0,-1,0);glVertex3d(-1,0,+1);
glNormal3d(0,-1,0);glVertex3d(+1,0,-1);
glNormal3d(0,-1,0);glVertex3d(+1,0,+1);
glEnd();

return TRUE;
}




edit by evolutional- Source tags, people, source tags!

[Edited by - evolutional on June 15, 2005 6:12:34 AM]

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!