Archived

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

Simulating Multitexture

This topic is 5148 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 want to know the exact way to perfectly simulate Multitexturing to do a 3-unit texturing, and more . I`ve been testing with something like this but I have some unwanted artifacts->
glEnable(GL_BLEND);//I`ve seen that blending doesn`t affect it

glDepthFunc(GL_ALWAYS);
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
DrawModel(Texture1);//for only 2 textures yet...

DrawModel(Texture2);
glDisable(GL_BLEND);
glDepthFunc(GL_LEQUAL);

Share this post


Link to post
Share on other sites
I eventually found that this works just fine ->(no blending)

glDepthFunc(GL_ALWAYS);
DrawModel(Texture1);
glDepthFunc(GL_LEQUAL);
DrawModel(Texture2);
glDepthFunc(GL_LEQUAL);


but... the model appears in front of everything else and... I need to fix that too... any ideas ?

Share this post


Link to post
Share on other sites
It seems I found the goldmine, and the missing link... the final code->

glDepthFunc(GL_LESS);
DrawModel(Texture1);
glDepthFunc(GL_LEQUAL);
DrawModel(Texture2);


That works just fine... if you have an alternative let me know

Share this post


Link to post
Share on other sites

glDepthFunc(GL_LEQUAL); // or GL_LESS, depending on your preference

DrawModel(Texture1);
glDepthFunc(GL_EQUAL);
DrawModel(Texture2);
// glDepthFunc(GL_EQUAL);

DrawModel(Texture3);
glDepthFunc(...); // Restore the GL_LESS or GL_LEQUAL function


Beware, all texture environments can not be emulated by multipass.
Simple environments like modulation and addition are possible, but things more complex (especially when involving alpha texture) sometimes can not be emulated by hardware with fewer texture units.

[edited by - vincoof on November 10, 2003 8:19:45 AM]

Share this post


Link to post
Share on other sites