PDA

View Full Version : light effect is somehow disabled.



swatkdw
07-06-2009, 09:18 AM
hi guys. I am practicing opengl technoques.

light effect appears to be disabled on the object that texture mapped. sorry for bad English.

I have made changes to the line orders between light and texture and and etc to make it work.

here's the code below the link. hope you see what's going on here.. it's quite long.

http://pastebin.com/d56cac275

ZbuffeR
07-06-2009, 09:56 AM
This line means "replace by texture, according to alpha", and it is not what you want :
gl.glTexEnvf(GL.GL_TEXTURE_ENV, GL.GL_TEXTURE_ENV_MODE, GL.GL_DECAL);

You want instead to multiply the lit color by the texture color :
gl.glTexEnvf(GL.GL_TEXTURE_ENV, GL.GL_TEXTURE_ENV_MODE, GL.GL_MODULATE); // the default, by the way

It already was a Frequently Asked Question 10 years ago :
http://www.opengl.org/resources/faq/technical/texture.htm#text0030

have fun :)

swatkdw
07-06-2009, 10:22 AM
THANK YOU VERY MUCH. F A N T A S T I C