Jump to content
  • Advertisement
Sign in to follow this  
chenmy1

OpenGL GL Light or Color problem...

This topic is 4471 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 one problem. Opengl Light or Color Doesnt work. fx 5200 run normal: Normal But fx 5500 doesnt work: Not Normal what is the problem. edit: Project: Download code //light float d1light[]={ 0.7f, 0.7f, 0.7f, 1.0f }; float a1light[]= { 0.2f, 0.2f, 0.2f, 1.0f }; float s1light[] = {0.5f, 0.5f, 0.5f, 1.0f}; float p1light[] = { 100.0f, 100.0f, 100.0f,0.0 }; float dir1light[]= { 0.0f, -1.0f,0.0f, 1.0f }; float d2light[]={ 0.5f, 0.0f, 0.0f, 1.0f }; float p2light[] = { 0.0f, 15.0f, 15.0f, 0.0 }; float d3light[]={ 0.5f, 0.5f, 0.0f, 1.0f }; float p3light[] = { 15.0f, 15.0f, 0.0f, 0.0 }; void XXX:setLight() { glLightfv(GL_LIGHT0, GL_AMBIENT, a1light); glLightfv(GL_LIGHT0, GL_DIFFUSE, d1light); glLightfv(GL_LIGHT0, GL_POSITION,p1light); glLightfv(GL_LIGHT0, GL_SPECULAR,s1light); glLightfv(GL_LIGHT0,GL_SPOT_DIRECTION,dir1light); glLightf(GL_LIGHT0,GL_SPOT_EXPONENT,70.0); glLightf(GL_LIGHT0,GL_SPOT_CUTOFF,180.0); glLightf(GL_LIGHT0,GL_CONSTANT_ATTENUATION,1.0); glLightf(GL_LIGHT0, GL_QUADRATIC_ATTENUATION, 0.0); glLightf(GL_LIGHT0, GL_LINEAR_ATTENUATION, 0.0); glEnable(GL_LIGHT0); glLightfv(GL_LIGHT1, GL_DIFFUSE, d2light); glLightfv(GL_LIGHT1, GL_POSITION,p2light); glEnable(GL_LIGHT1); glLightfv(GL_LIGHT2, GL_DIFFUSE, d3light); glLightfv(GL_LIGHT2 ,GL_POSITION,p3light); glEnable(GL_LIGHT2); glEnable(GL_LIGHTING); } //material float d1mat[]={ 1.0f, 1.0f, 1.0f, 1.0f }; float a1mat[]={ 0.9f, 0.9f, 0.9f, 1.0f }; float s1mat[]={ 0.0f, 0.0f, 0.0f, 1.0f }; float e1mat[]={ 0.0f, 0.0f, 0.0f, 1.0f }; float shi1[] = { 0 }; void XXX:setHaritaMaterial() { glColorMaterial(GL_FRONT_AND_BACK,GL_AMBIENT_AND_DIFFUSE ); glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, a1mat); glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, d1mat); glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, s1mat); glMaterialfv(GL_FRONT_AND_BACK, GL_SHININESS, shi1); glMaterialfv(GL_FRONT_AND_BACK, GL_EMISSION, e1mat); glEnable(GL_COLOR_MATERIAL); } [Edited by - chenmy1 on May 22, 2006 7:59:42 AM]

Share this post


Link to post
Share on other sites
Advertisement
OK, it looks as though its your lighting (rather than colour) it could be something to do with your attenuation settings, its a bit difficult to tell from the pictures it could be one of several things. Could you post you lighting code?

Luke.

P.S.

Linkified for the lazy:

Normal
Not Normal

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!