Multitexture

Started by
5 comments, last by silvermace 19 years, 10 months ago
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!)
Advertisement
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.
"When you die, if you get a choice between going to regular heaven or pie heaven, choose pie heaven. It might be a trick, but if it's not, mmmmmmm, boy."
How to Ask Questions the Smart Way.
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 stuffglBindTexture( GL_TEXTURE_2D, 0 );glActiveTexture( GL_TEXTURE0 );glBindTexture( GL_TEXTURE_2D, 0 );
SlimDX | Ventspace Blog | Twitter | Diverse teams make better games. I am currently hiring capable C++ engine developers in Baltimore, MD.
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? ;)
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.
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?
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
"I am a donut! Ask not how many tris/batch, but rather how many batches/frame!" -- Matthias Wloka & Richard Huddy, (GDC, DirectX 9 Performance)

http://www.silvermace.com/ -- My personal website

This topic is closed to new replies.

Advertisement