Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

tomalter

Problem in lighting

This topic is 5653 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 created a cylinder using quadrics. i tried to use lighting but i could not creat any light my cylinder always appears to be a 2D object . its only rotations that give some feel that i have create a cylinder a 3D object. please tell me what could be my mistake i have done the following GLfloat LightAmbient[] = { 0.5f, 0.5f, 0.5f, 1.0f }; GLfloat LightDiffuse[] = { 1.0f, 1.0f, 1.0f, 1.0f }; GLfloat LightPosition[] = { 1.0f, -1.0f, 2.0f, 1.0f }; GLvoid InitGL(GLsizei Width, GLsizei Height) { glClearColor(0.0f, 0.0f, 0.0f, 0.0f); glClearDepth(1.0); // Enables Clearing Of The Depth Buffer glDepthFunc(GL_LESS); glEnable(GL_DEPTH_TEST); glShadeModel(GL_SMOOTH); / glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(45.0f,(GLfloat)Width/(GLfloat)Height,0.1f,100.0f); glMatrixMode(GL_MODELVIEW); glLightfv(GL_LIGHT1, GL_AMBIENT, LightAmbient); glLightfv(GL_LIGHT1, GL_DIFFUSE, LightDiffuse); glLightfv(GL_LIGHT1, GL_POSITION,LightPosition); glEnable(GL_LIGHT1); / glBlendFunc(GL_SRC_ALPHA,GL_ONE); glColor4f(0.5f, 0.2f, 1.0f, 0.5); quadratic=gluNewQuadric(); gluQuadricNormals(quadratic, GLU_FLAT); / gluQuadricTexture(quadratic, GL_TRUE); }

Share this post


Link to post
Share on other sites
Advertisement

  • 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!