Jump to content
  • Advertisement

Archived

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

Maitrek

OpenGL Lightmapping with openGL

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

Hrm - I just want to ask a quick question. Are there really any alternative methods to doing lightmapping in opengl? I''ve yet to really give it a go, but i''m guessing it''s a multitexturing thing. And if it is, how would I combine the two textures in OpenGL? And also, I still seem to be having trouble with gllights on a voodoo 2, no matter what I do with them they seem to be full bright from whatever distance, maybe it''s an attenuation thing. Ahh well, any hints/help would be appreciated!

Share this post


Link to post
Share on other sites
Advertisement
Hi,

Well, I only know one way, the multitexturing way... You can do it like this:

Set your glTexEnv to GL_MODULATE
Draw your object normaly with your 1st texture
Enable GL_BLEND
Disable GL_DEPTH_TEST
Set the BlendFunc that you want (I usually use GL_SRC_ALPHA - GL_ONE_MINUS_SRC_ALPHA, but if I''m not wrong, the corret is GL_ONE - GL_ONE... can''t say for sure, sorry... you''ll just have to try both )
Draw your object again, with your lightmap set as texture

And that''s it! As you can see, you have to draw your geometry twice, but that can be avoided if you use Compiled Vertex Arrays... I''m not THAT sure it''s right, but that''s how I remember of it.
I don''t know about your Voodoo 2 problem though... are you using the latest drivers?

Hope that helps,
Nicodemus.

Share this post


Link to post
Share on other sites
You can also use the multitextureing extension so you only have to draw the object once, but your OpenGL ICD has to support it...

----------
Drago, VerSoft

Share this post


Link to post
Share on other sites
Drago - what are the functions involved in the multi-texturing extension, know of any decent documentation? I guess I''ll try the opengl.org or something.

Share this post


Link to post
Share on other sites
So there is no way that I can get gl to combine the two textures or something like that before I draw the geometry so I can avoid multi-texturing...and would setting the glTexEnv to GL_BLEND do?

Share this post


Link to post
Share on other sites
the extensions used are the ARB_multitexture and a logic op extension of which I do not remember the name right now.
You use those functions to switch the active texture unit. OpenGL.org has docs online.

Share this post


Link to post
Share on other sites
quote:
Original post by Maitrek

So there is no way that I can get gl to combine the two textures or something like that before I draw the geometry so I can avoid multi-texturing...and would setting the glTexEnv to GL_BLEND do?


You''d have to do this yourself by altering the textures, but aside from being slow, you''d also lose a major advantage of lightmapping. You''d wind up generating a unique texture for every surface in your scene, and unless they''re pretty low quality you most likely won''t have memory for it. Even if gl could combine the textures itself without multitexture, you''d be faced with this problem.

But why exactly don''t you want to use that? V2s are good at it.

Share this post


Link to post
Share on other sites
I don''t really. I''d like to render all the textures in one pass (multi-texturing) anyway I''ll just run around and look for more stuff on the ARB extension.

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!