how to do modulation to simulate lighting effects ???

Started by
14 comments, last by stormrunner 19 years, 8 months ago
cheers - you win the doc war. but if your only point is that that one assumption is wrong, perhaps it'd be beneficial to the OP to explain how in conjunction with glTexEnvi (or without ?)
Quote:It's not true that glTexEnvi specifies how your textures are combined with colors in the frame buffer - it would be blending and glBlendFunc and glEnable/Disable(GL_BLEND).

is relevant and would be used.
- stormrunner
Advertisement
I didn't meant to take part in a war:) - only to correct one thing that event wasn't important in this thread but might be confusing for graveyard filla in the future. You was right, execpt this one little thing...
www.tmreality.com
ok, im a little confused now. what was the dispute about? and what do i have to do to get the effect i want?


"It's not true that glTexEnvi specifies how your textures are combined with colors in the frame buffer - it would be blending and glBlendFunc and glEnable/Disable(GL_BLEND). Tex env specifies how during particular pass color's from different sources(textures,diffuse,specular etc) are mixed withing texture units - that's all. Only the output value is blended into frame buffer"

im just a little confused... so glTexEnvi is what i want to use to get the modulation effect (IE blend the actual color of the quad with the texture).... so then what does blendFunc have to do with it then? and was i correct about how to disable it? just send the function DECAL to go back to normal? thanks again for your guys help!
FTA, my 2D futuristic action MMORPG
*sheepish grin* don't worry, we were just being anal about the details. i paid no attention to detail and made a general statement that ignored those details/got them completely wrong.
tomek_zielinski's point that
Quote:Tex env specifies how during particular pass color's from different sources(textures,diffuse,specular etc) are mixed withing texture units

was correct.
you can use glTexEnvi without blending being enabled provided you aren't trying to blend two textures over each other (multi-texturing). neither tomek_zielinski's msdn doc nor my book mentioned needing GL_BLEND for regular tasks, so i'm assuming you don't. someone correct me if thats wrong.
Quote:just send the function DECAL to go back to normal?

Quote:taken from Opengl Game Programming
The default value for glTexEnvi() is GL_MODULATE

normal = default. the "normal" value is GL_MODULATE.
just for reference, you can specify a different glTexEnvi() for each texture.

[Edited by - stormrunner on August 4, 2004 7:37:19 PM]
- stormrunner
hmm.. im just a little confused still.. sorry if you think im stupid.

so its not a state then? i would specify it for each texture? cuz the docs that ive found show no where to specify the texture. im guessing once you call the function, any primitives drawn after that will follow the rules the function called, untill i call the function again with different parameters??

also, if the default is MODULATION, how come when i draw a quad with a texture and color, i only see the texture?

thanks again for all your help!
FTA, my 2D futuristic action MMORPG
Quote:im guessing once you call the function, any primitives drawn after that will follow the rules the function called, untill i call the function again with different parameters

precisely, its just like most other opengl functions. its effects (as far as i can tell) are activated once you call it, but the glTexEnvi call is only valid between the glEnable(GL_TEXTURE_2D) and the subsequent glDisable call, just like the functions beneath blending and lighting. sorry if that wasn't clear. opengl doesn't presume to know what you want - so even though the default is GL_MODULATE, you have to let it know to activate that, or change it to something else, otherwise it won't happen. i suppose your original supposition was "technically" correct - that the "global" opengl default is GL_DECAL, until you call glTexEnvi or use a blending function.
Quote:cuz the docs that ive found show no where to specify the texture

examples of using glTexEnvi can be found here for multi-texturing (don't know if that helps) here, and here. check them out - each shows a different way( in application) to use the function (i think, i didn't read them through), although the last one is probably the clearest use of it.

<edit> deleted redundant link
<edit> "using" the function as in loading textures with it
- stormrunner

This topic is closed to new replies.

Advertisement