Sign in to follow this  
LordKraken

Help about glMultiTexCoord

Recommended Posts

LordKraken    122
Hi all, I'm going into multitexturing now, and I'm told that I have to use glMultiTexCoord for that. It is quite easy to use, but I'm still wondering about the 2 last parameters. For example, let say I have: glBegin(GL_QUADS); glMultiTexCoord2fARB(GL_TEXTURE0_ARB, 0.0, 0.0); glMultiTexCoord2fARB(GL_TEXTURE1_ARB, 0.0, 0.0); glVertex3f(-FloorSize, 0.0, -FloorSize); glMultiTexCoord2fARB(GL_TEXTURE0_ARB, 1.0, 0.0); glMultiTexCoord2fARB(GL_TEXTURE1_ARB, 0.5, 0.0); glVertex3f(FloorSize, 0.0, -FloorSize); glMultiTexCoord2fARB(GL_TEXTURE0_ARB, 1.0, 1.0); glMultiTexCoord2fARB(GL_TEXTURE1_ARB, 0.5, 0.5); glVertex3f(FloorSize, 0.0, FloorSize); glMultiTexCoord2fARB(GL_TEXTURE0_ARB, 0.0, 1.0); glMultiTexCoord2fARB(GL_TEXTURE1_ARB, 0, 0.5); glVertex3f(-FloorSize, 0.0, FloorSize); glEnd(); Does that mean that all my uv coordinates will be scale from [0,1] to [0,0.5]? Now, let say I have a simple square surface. I want a standard (wood) texture on it on the first layer, and a second, smaller texture to simulate lighting on the second layer. Is it possible to use the code above to render this scene? Or did I miss something? Thanks.

Share this post


Link to post
Share on other sites
angry    128
It's coordinates and wont scale anything. The coords 0,0 is the lower left corner of the picture and 1,1 is the upper right corner of the picture. Therefor 0.5,0.5 is the half picture. So specifiying 0.5 coords will cut the image/texture in half, not scale it.
If you want to scale the texture you have to modify the texture matrix by first changing to texture matrix mode; glMatrixMode(GL_TEXTURE) and then scale it by glScalef().

Share this post


Link to post
Share on other sites
LordKraken    122
Well in fact, I did make a very stupid mistake, coz by replacing 0.5 by 2, I got my effect achieved. But you're right, using a texture matrix is more efficient and logical.

Thanks for your help :)

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