Jump to content
  • Advertisement

Archived

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

Instruo

GL Lighting Question

This topic is 5215 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''m probably doing something really stupid here, but my poor tired brain can''t sort it out right now (3 1/2 hours of sleep + 9 hours of work = da lose...) Anyway, I''m trying to get some basic smooth shading going here, but it''s not working. When I add I light to my scene, the whole thing goes black... Someone tell me what I''m missing, please? glShadeModel(GL_SMOOTH); glFrontFace(GL_CCW); glEnable(GL_DEPTH_TEST); glEnable(GL_TEXTURE_2D); glEnable(GL_LIGHTING); glEnable(GL_LIGHT0); GLfloat pos[] = { 1.0, 1.0, 1.0, 1.0 }; GLfloat amb[] = { 1.0, 1.0, 1.0, 1.0 }; glLightfv(GL_LIGHT0, GL_POSITION, pos); glLightModelfv(GL_LIGHT_MODEL_AMBIENT,amb);

Share this post


Link to post
Share on other sites
Advertisement
You are activating textures without specifing an active texture.
Furthermore, when using lighting you must specify a material for the polygon with glMaterial.

Share this post


Link to post
Share on other sites
I''m doing both of these things, just not in this piece of code Sorry. My models show up just fine if I don''t enable GL_LIGHTING, but it''s all black after I do.

Share this post


Link to post
Share on other sites
are you setting the normals correctly?
I think the (d)effect you are talking about can come from normals pointing "in" instead of out....

good luck

--Spencer

"All in accordance with the prophecy..."

Share this post


Link to post
Share on other sites

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