PDA

View Full Version : MultiTexturing and NormalTexturing



stryx
03-23-2002, 12:24 AM
Hi, I'm using Multitexturing this way:

glActiveTextureARB(GL_TEXTURE0_ARB);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, texture[PICTURE_ID]);

and I draw it with:

glMultiTexCoord2fARB(GL_TEXTURE0_ARB, 0.0f, 1.0f);
glMultiTexCoord2fARB(GL_TEXTURE1_ARB, 0.0f, 1.0f);
glVertex3f(-1, 1, 1);

...

It works, but when I now want to draw things without Multitexturing It is black without any texture.

I do this like this:

glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, texture[PICTURE2_ID]);

glBegin(GL_QUADS);
glTexCoord2f(0.0f, 1.0f); glVertex2f(-5, -5);
...


What am I doing wrong ?

Normal works. Multi works, but not together.

Help please,
Thanks
StryX

Bob
03-23-2002, 03:13 AM
Do you disable the second texture unit when you dont't need it anymore?

stryx
03-23-2002, 05:04 AM
No, How to do that ???

chxfryer
03-23-2002, 07:08 AM
Switch to second texture unit
glActiveTextureARB(GL_TEXTURE1_ARB);
disable it
glDisable(GL_TEXTURE_2D);
switch back to first
glActiveTextureARB(GL_TEXTURE0_ARB);

Bob
03-23-2002, 08:39 AM
I'm sorry, but I find it very amazing that people can enable stuff, but don't know how to disable it. It should be very clear how to do if you read some (any!) documenation about it.

A rule: If you enable it with glEnable, you diable it with glDisable.

stryx
03-23-2002, 08:39 AM
Thanks, It works now !

stryx
03-23-2002, 08:44 AM
my problem was not to disable it.

I forgot to switch back to TEX 0.

Thanks anyway.

I agree to you 'RULE'.

Bob
03-23-2002, 09:31 AM
I apologise for being rude, but a question like "how to do that" just begs for an RTFM answer.

Anyways, glad we could help you.

zed
03-23-2002, 11:16 AM
>>my problem was not to disable it.
I forgot to switch back to TEX 0.<<

this has gotten me as well before, until i remembered 'opengl is a state machine'