Sign in to follow this  
Maxwan

Multitexture

Recommended Posts

Maxwan    122
Even if it works most of the time, ARB multitextureing gives me alot of troubles when I'm making my game. I only know the basic stuff about it, so maybe there's where my problem is :) .. well, first of all, I've written a code that renders a terrain and I've also written a code for loading models. Both of these works fine, however, when I finally was finished with them and mixed them together, the real problems with the multitexture started. When rendering the terrain with multitexture, and the models without, the texture on the models disappear. I wanna just "shut off" the multitexture in the middle of my renderingcode, but I don't know how to do it...? Or is it a better way to deal with the problem? Also, let me have your opinion about the best way to get multitextured terrain, I mean, it's possible to do it with blending and stuff like that too. And finally, anyone that knows a good page with help/tutorials for ARB multitexture? (and no, don't point me to NeHe!)

Share this post


Link to post
Share on other sites
CodeMunkie    805
You are probably forgetting to (edit) unbind texture unit 1 and then switch back to texture unit zero (/edit) after rendering your multitexture terrain and before rendering your single texture models.

Share this post


Link to post
Share on other sites
Promit    13246
To "turn off" multitexture, simply go to every layer to bound a texture and disable the texture. Then shift back to tex unit 0 and you're good to go. For example:

glActiveTexture( GL_TEXTURE0 );
glBindTexture( GL_TEXTURE_2D, MyTex1 );

glActiveTexture( GL_TEXTURE1 );
glBindTexture( GL_TEXTURE_2D, MyTex2 );

//render stuff

glBindTexture( GL_TEXTURE_2D, 0 );
glActiveTexture( GL_TEXTURE0 );
glBindTexture( GL_TEXTURE_2D, 0 );

Share this post


Link to post
Share on other sites
Maxwan    122
Yeah, you guys understand the problem, however, God seems to hate me and when I'm using glBindTexture( GL_TEXTURE_2D, 0 ); to unbind the texture, the result is even worst than before.

I've written as you told me, trying to unbind but it doesn't work. Did you write something wrong; does God really hate me; or am I just stupid? ;)

Share this post


Link to post
Share on other sites
mikeman    2942
Completely forget what those other guys said.To disable multitexturing means that you only want one texture unit to be enabled.What you have to do is to disable texturing in all the others.Let's say you have 2 texunits,and you want to "turn off" multitexturing:

glActiveTextureARB(GL_TEXTURE1_ARB);//Switch to texunit1
glDisable(GL_TEXTURE_2D);//Disable texturing for texunit1

glActiveTextureARB(GL_TEXTURE0_ARB);//Switch to texunit0
glEnable(GL_TEXTURE_2D);//Enable texturing for texunit0

To enable multitexturing,just enable texturing for both stages.The same principle stands for situations with more than 2 texture stages.

Share this post


Link to post
Share on other sites
Maxwan    122
Thanks. Now everything works.

Anyway, anyone that knows a good site with ARB?

And any opinion about the multitexture, is ARB multitexture the best way to go with, or anyone suggesting anything else?

Share this post


Link to post
Share on other sites
silvermace    634
Nowadays ARB_multitexture (MT) is pretty much supported by almost all decent videocards. MT is safe to use, and if that even failes you could switch to Multipass rendering and EXT_compiled_vertex_array (CVA's)

good place to start:
www.google.com & www.codesampler.com

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this