PDA

View Full Version : Texture problem?



steinlee
12-16-2003, 08:23 AM
I have two textures in my scene. Half for sky and half for ground. When I ran displaying
these two textures in one code, they two
appeared. However, when I copy the same
code of displaying two textures in another
code. the ground one disappeared. I checked
that the texture for ground is loaded
correctly because I display it as sky and it
appears. What can be the problem? Thanks for
help.

Leyder Dylan
12-16-2003, 08:34 AM
When you say that your texture disappear, you mean that it is blank ?

Post your drawgl scene code pls

steinlee
12-16-2003, 10:23 AM
// texture1 is ground
// texture2 is sky
// I can see texture2 only
// if I switch them, I can see ground as sky.
// texture1 never appears. This piece od code
// works in another code. Thank you for your
// help

glDisable(GL_BLEND);
texture1->activate(); //texture is a class

glColor4f( c1, c2, c3, 1.0f );

glBegin(GL_QUADS);
glTexCoord2i(0, 3);
glVertex3f(-300,-15.5,-300);
glTexCoord2i(3, 3);
glVertex3f( 300,-15.5,-300);
glTexCoord2i(3, 0);
glVertex3f( 300,-15.5, 500);
glTexCoord2i(0, 0);
glVertex3f(-300,-15.5, 500);
glEnd();

float t = 1.0;
texture2->activate();
glBegin(GL_QUADS);
glTexCoord2f(0-t,3);
glVertex3f(-300,100,-300);
glTexCoord2f(3-t,3);
glVertex3f(300,100,-300);
glTexCoord2f(3-t,0);
glVertex3f(300,100,500);
glTexCoord2f(0-t,0);
glVertex3f(-300,100,500);
glEnd();

glBegin(GL_QUADS);
glTexCoord2f(0-t,1);
glVertex3f(-300,-15.5,-300);
glTexCoord2f(3-t,1);
glVertex3f(300,-15.5,-300);
glTexCoord2f(3-t,0);
glVertex3f(300,100,-300);
glTexCoord2f(0-t,0);
glVertex3f(-300,100,-300);
glEnd();

glBegin(GL_QUADS);
glTexCoord2i(0,1);
glVertex3f(-300,-15.5,500);
glTexCoord2i(3,1);
glVertex3f(300,-15.5,500);
glTexCoord2i(3,0);
glVertex3f(300,100,500);
glTexCoord2i(0,0);
glVertex3f(-300,100,500);
glEnd();

glBegin(GL_QUADS);
glTexCoord2i(0,1);
glVertex3f(300,-15.5,-300);
glTexCoord2i(3,1);
glVertex3f(300,-15.5,500);
glTexCoord2i(3,0);
glVertex3f(300,100,500);
glTexCoord2i(0,0);
glVertex3f(300,100,-300);
glEnd();

glBegin(GL_QUADS);
glTexCoord2i(0,1);
glVertex3f(-300,-15.5,-300);
glTexCoord2i(3,1);
glVertex3f(-300,-15.5,500);
glTexCoord2i(3,0);
glVertex3f(-300,100,500);
glTexCoord2i(0,0);
glVertex3f(-300,100,-300);
glEnd();

glEnable(GL_BLEND);