Multitexturing: What happens to layer 3 ?

Hi, I’m using
glActiveTextureARB(GL_TEXTURE0_ARB);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, texture[stone.tex_index]);

to perform multitexturing.

This Lines with GL_TEXTURE0_ARB,GL_TEXTURE1_ARB and GL_TEXTURE2_ARB,

Whatever OpenGL only renders GL_TEXTURE0_ARB and GL_TEXTURE2_ARB to the screen.

What happenes to my 2nd layer ?

info: after using I disable Multitexturing like this:

glActiveTextureARB(GL_TEXTURE2_ARB);
glDisable(GL_TEXTURE_2D);
glActiveTextureARB(GL_TEXTURE1_ARB);
glDisable(GL_TEXTURE_2D);
glActiveTextureARB(GL_TEXTURE0_ARB);
glEnable(GL_TEXTURE_2D);

Please help,
Thanks
StryX

You probably don’t have more than two texture units. Call glGetIntegerv with GL_MAX_TEXTURE_UNITS to see how many units you have.

Hm, ok I’ve only 2 Texture Units.

But how can I use 3 Layers with 2 Texture Units ??

Is it possible to have a 3 layered Texture with 2 T.Units ???

I need, Texture
Lightmap
Effect/Detail Map

How can I put this into 1 texture ??

If you want to use more than two textures, you will have to buy a new graphics card, or render your object in more than one pass.

Multipass, hmm, sounds good.

Is there any tutorial or something about that ?

(I’m learning OpenGL for 2 weeks now)

What about the speed ?
What would be the frame difference ?

if (multipass) then fps=fps/2 ???

Thanks, anyway

StryX

Multipass is slower than single pass since it makes 2 or more passes on the actual geometry, that means you are making twice as many glVertex3f calls and so on. You can speed it up by putting the polygons into display lists or CVA’s. It is not 2 times slower since there are other factors that remain unchanged. The geometry calculationg WILL be 2 times slower but the end fps will not be hit as badly as that.

You need to use some sort of blending for the second pass too, otherwise you’d simply overwrite the first pass. To reduce the fill rate overhead, use glDepthFunc(GL_EQUAL); for the second and subsequent passes.