• ### Announcements

#### Archived

This topic is now archived and is closed to further replies.

# Two textures

## Recommended Posts

I would like to use two textures one the same quad. So I wrote a easy code that solved my problem. Anyway, this code uses two quads at the same size, one with the first texture, and the second with the other texture, and the second texture has partly a alpha-channal. It looks nice and the way I want it, but, would''nt it go faster if I used two textures on the same quad, instead of making two quads? Here''s my code. Can someone make it better?

glEnable(GL_TEXTURE_2D);
glEnable(GL_ALPHA_TEST);
for (int a=0 ; a<2 ; a++)
{
glTranslatef(0.0f, 0.0f, -10.0f);
if (a==0) {
glBindTexture(GL_TEXTURE_2D, textur[0]);
glAlphaFunc(GL_ALWAYS, 0.0f);
}
if (a==1) {
glBindTexture(GL_TEXTURE_2D, textur[1]);
glAlphaFunc(GL_EQUAL, 1.0f);
}
glTexCoord2f(0.0f, 0.0f);	glVertex3f(-1.0f, -1.0f, 0.0f);
glTexCoord2f(1.0f, 0.0f);	glVertex3f( 1.0f, -1.0f, 0.0f);
glTexCoord2f(1.0f, 1.0f);	glVertex3f( 1.0f,  1.0f, 0.0f);
glTexCoord2f(0.0f, 1.0f);	glVertex3f(-1.0f,  1.0f, 0.0f);
glEnd();
}


##### Share on other sites
True, it would be faster if you used multitexturing instead.

Have a look here: http://www.berkelium.com/OpenGL/GDC99/multitexture.html

##### Share on other sites
Tack för hjälpen men..

''glActiveTextureARB'' : undeclared identifier
Missing a include-file? or am I just stupid..

##### Share on other sites
inga problem.

You have to include these extensions as they''re not a part of the main gl.h file which unfortunately is a quite cumbersome procedure(at least I thought so). If you want to make life easy for yourself have a look at "extension loading library" at this site:

http://www.levp.de/3d/

##### Share on other sites
im using a extension loading library.. ive tried glux and glee, and both have the same problem :-/
it has to be something else, i looked in the glee header and its defined in there but wtf!!! visual studio :| ?

• ## Partner Spotlight

• ### Forum Statistics

• Total Topics
627680
• Total Posts
2978610

• 13
• 12
• 10
• 12
• 22