Archived

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

Two textures

This topic is 5008 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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++)
	{
		glLoadIdentity();
		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);
		}
		glBegin(GL_QUADS);
			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 this post


Link to post
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 this post


Link to post
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 :| ?

Share this post


Link to post
Share on other sites