Archived

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

The_Nerd

OpenGL Multitexturing in OpenGL

Recommended Posts

Hi! I am new to multitexturing, although I do know how multipass multitexturing works. What I want to do is multitexture with extensions blending each layer (TEXTUREn _ARB) as though it was multipass multitexturing. I have my first texture:

My second texture (the white is alpha):
Now I want to blend them together as if the blending function for texture 2 pass 2 was GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, like this:
How do I accomplish this? It said "Requires Windows 98 or better", so I installed Linux. [edited by - The_Nerd on April 6, 2004 3:31:19 PM]

Share this post


Link to post
Share on other sites
I am exausted! I have looked and looked for the answer! Doesn''t any body know the answer? Doesn''t anybody know where I can at least find a spec sheet, tutorial, or something that actually explains multitexturing WELL???

-------------------------------------------------------
It said "Requires Windows 98 or better", so I installed Linux.

Share this post


Link to post
Share on other sites
What you need to do is combine both of those textures into one texture. Take your first color texture, add an alpha component to it, then fill the alpha component will either the red, green, or blue component of the second one. It doesn''t matter since its black and white, r,g,b will all be the same.

Once you create this alpha channel in the first texture, then load the texture into OpenGL and simply texture your quad with a single texture with blending enabled just like you have and it will work.

If you want to know the way to do it using mulitexuring, then you take the second texture and create an alpha channel for it, and place the r,g, or b values into that channel. Then set your Multitexturing as so...

//alpha map
glActiveTextureARB(GL_TEXTURE0_ARB);
glEnable(GL_TEXTURE_2D);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE0_RGB, GL_TEXTURE1);
glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_COLOR);

//texture map
glActiveTextureARB(GL_TEXTURE1_ARB);
glEnable(GL_TEXTURE_2D);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);
glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA, GL_TEXTURE0);
glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA, GL_SRC_ALPHA);


I hope this helps. I had the same problem a long time ago, and nobody helped me :-(

Share this post


Link to post
Share on other sites
2nd or 3rd hit on google for Opengl multitexturing was this:
http://tfpsly.planet-d.net/english/3d/multitexturing.html

but this will be very useful as well:
http://oss.sgi.com/projects/ogl-sample/registry/ARB/texture_env_combine.txt

Share this post


Link to post
Share on other sites
I was already at both pages WarAmp! Thanks for the help oconnellseanm, I''ll try that. Thanks again every buddy!

-------------------------------------------------------
It said "Requires Windows 98 or better", so I installed Linux.

Share this post


Link to post
Share on other sites