View Full Version : Multitexture with more than 2 textures.

11-17-2002, 02:11 AM

I have a working programe that puts two textures on a cube.
Now I wanted to add a third texture and run into some problems.
Mainly what happens is that the third texture totaly substitutes the second one.
Although I only have the 'third' texture on one face of the cube it appears everywhere instead of the second one.

I cannot see any obvious reason for that.
Is the approach to more than 2 textures different to only 2 textures?

Thanks for any help!

11-17-2002, 07:24 AM
Are you using multitexture, or multiple drawing passes? Radeons have 3 texture units so you can do 3 textures in one pass, Radeon8500 has 6, Geforce2 has 2 texture units, and I think Geforce3 and 4 has 4 units, but I'm not positive on that. If your card only supports 2 texture units, you'll have to do a second rendering pass to get the third texture to show up, and use the correct mode (GL_MODULATE?).

Also, if you only want the 3rd texture to show up on one face of the cube, disable texturing after drawing the first face and it won't be drawn on the subsequent faces.

Hope that helps.

11-17-2002, 08:51 AM
Yes it indeed helps.
At some point it came to me that my GeForce 2 can only draw 2 textures in one pass, and you confirmed that.
Is it hard to design a second rendering pass?
If you could point me to some tutorial that would be kind of you.
Thanks for the help!

11-17-2002, 11:08 AM
Cool, glad that helped you out. http://www.opengl.org/discussion_boards/ubb/smile.gif

As far as multipass rendering, you basically just draw your object again, with the blending mode set to your desired effect. I think a good explanation of the differences is here: http://www.delphi3d.net/articles/viewarticle.php?article=lightmapping.htm

A cool project to see/learn the difference in multitexturing and multipass rendering would be to do a simple lightmapping technique of a quad, and toggle between multitexturing and 2 passes to get the same effect. There's a good multitexturing tutorial you could base this on at: http://www.gametutorials.com

For more info I'd suggest a google search on "opengl multipass rendering" or something like that, should help you get the general idea.

Good luck, and let us know how it turns out. http://www.opengl.org/discussion_boards/ubb/smile.gif

11-18-2002, 12:03 AM
Thanks for the links!
I have no time to check them out in detail right now. (my multitexturing code is based on a www.gametutorials.com (http://www.gametutorials.com) tutorial, do we mean the same?)
I got a question though. You said that I basically just draw my object again, does that mean that I realy draw it again, with all the geometry and so on?

Thanks again for the links, I'll check them out later.

11-18-2002, 06:37 AM
Yes, I believe we are talking about the same tutorial at http://www.gametutorials.com That was a very helpful tutorial to me when I was first learning about multitexturing, since it is a very simple example that made the concepts easy to grasp. http://www.opengl.org/discussion_boards/ubb/smile.gif

So my suggestion was to turn that tutorial into a program that would allow you to draw the lightmapped quad 2 ways, via multitexture (as it exists now), and then with the press of a button it would change to a multipass algorithm instead.

Basically, you would draw the quad with the base texture. Then, set your blending mode to get the desired effect, bind the lightmap texture, and then draw the same quad again. This should have the same effect as drawing the quad once with multitexturing, but will show you how the multipass rendering works.

Hope that makes sense. http://www.opengl.org/discussion_boards/ubb/smile.gif

11-19-2002, 06:03 AM
Umm yeah, of course it makes sense.
I have no idea though how to achieve multipass rendering in OpenGL. I cannot imagine how those two cubes will fit together. hmmmm...

11-19-2002, 06:12 AM
Perhaps this article can explain it better than I am able:

11-20-2002, 03:48 AM
Ha, you are a genious!
Now I got 4 different textures on one cube
(running on a GeForce2), so the main goal is achieved. I am still having minor 'problems'
to control how the textures are blended together between the two passes, but I guess I will find some satisfying solutions for that.
I have definitely 4 textures on that cube, though, and thats nice.

Thanks alot for the help!