Multi-texturing in OpenGL...

Started by
1 comment, last by iNsAn1tY 22 years, 3 months ago
Merry Christmas to everyone!!! I was just wondering if anyone knew how to do multi-texturing in OpenGL? I know Quake III uses multi-texturing when you put it in Lightmap mode, because when you shoot something like a rocket across a surface, the circular lighting map for the rocket is superimposed on top of the surface''s texture, but in a specific position (try it yourself). I''m writing a 3D engine, and I''d like this to be my primary kind of lighting. I can create the lightmaps before hand, when I make the actual maps, and it really does give a good sense of realism. I know it may have something to do with OpenGL extensions, but any suggestions would be helpful...And again, Merry Christmas! iNsAn1tY - the place where imagination and the real world merge... Try http://uk.geocities.com/mentalmantle
My opinion is a recombination and regurgitation of the opinions of those around me. I bring nothing new to the table, and as such, can be safely ignored.[ Useful things - Firefox | GLee | Boost | DevIL ]
Advertisement
one possible method (there are a lot of possibilities)

glActiveTextureARB(GL_TEXTURE0_ARB);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, texture0);

glActiveTextureARB(GL_TEXTURE1_ARB);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, texture1);

glBegin(GL_QUADS);
glMultiTexCoord2fARB(GL_TEXTURE0_ARB, 0,0);glMultiTexCoord2fARB(GL_TEXTURE1_ARB, 0,0); glVertex3fv(corner1);
glMultiTexCoord2fARB(GL_TEXTURE0_ARB, 1,0);glMultiTexCoord2fARB(GL_TEXTURE1_ARB, 1,0); glVertex3fv(corner2);
glMultiTexCoord2fARB(GL_TEXTURE0_ARB, 1,1);glMultiTexCoord2fARB(GL_TEXTURE1_ARB, 1,1); glVertex3fv(corner3);
glMultiTexCoord2fARB(GL_TEXTURE0_ARB, 0,1);glMultiTexCoord2fARB(GL_TEXTURE1_ARB, 0,1); glVertex3fv(corner4);
glEnd();

there are a lot of examples on the net use google also download the opengl1.3spec from www.opengl.org it has a thorough description

http://uk.geocities.com/sloppyturds/gotterdammerung.html
You don''t necessarily need multitexturing to do lightmapping. You can also do it with a single texture unit, using two passes.

This topic is closed to new replies.

Advertisement