Jump to content
  • Advertisement

Archived

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

Phillip Palk

OpenGL colour banding with OpenGL lighting

This topic is 5899 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

Ok, what''s basically happening is that whenever i try to render some terrain (really simple, just connect-the-dot on a heightmap) with lighting enabled i keep getting bands of color/blackness running parallel to the x-axis. When I render the terrain, all i do is use glDrawElements and draw one big triangle strip that covers my entire terrain, with the vertex,normal and colour pointers set and appropriate client states enabled. The lighting is setup with glEnable(GL_LIGHTING); glEnable(GL_LIGHT0); glEnable(GL_COLOR_MATERIAL); glEnable(GL_NORMALIZE); static GLfloat intensity[] = { 0.7, 0.7, 0.7, 1.0 }; static GLfloat position[] = { 0, -10, 0, 1 }; glLightfv(GL_LIGHT0,GL_POSITION,position); glLightfv(GL_LIGHT0,GL_DIFFUSE,intensity); Now i''m 99.99% sure that my indicies and normals are setup properly. I''ve got backface culling turned on so if my indicies were screwed some triangles wouldn''t get drawn, and i did a render drawing lines for my normals and they were all pointing in the right direction. my colour values are right aswell as it draws fine without lighting the colour bands run parallel to the x-axis, the same orientation as the triangle strip. when my normals all point directly up (0,1,0) the they are distinct bands but when i use my calculated normals it comes up in a more grid-like pattern so my question is what the hell could cause this!? ...so who wants to place bets that it''s something really simple over been overlooking?

Share this post


Link to post
Share on other sites
Advertisement
never mind....

i was storing normals as 4d vectors but OGL was expect 3d, so stepping through the buffer got out of sync. fixed it by setting the stride

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!