PDA

View Full Version : Texture not showing



shawn619
07-24-2012, 10:25 AM
I'm using the SOIL library to load images.

I don't get any compiling errors, and i have texture mapped images fine in the past with this process.

Problem: Texture not showing up in quad (plane).

Variables:


GLuint _SignId;


Draw call:


void drawSign(){

glDisable(GL_COLOR_MATERIAL);

glPushMatrix();



glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, _SignId);
//glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
//glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);

glBegin(GL_QUADS);
glNormal3f(0.0, 0.0, 1.0);

glTexCoord2f(0.0f, 0.0f);
glVertex3f(signX + 0.0f, signY + 0.0f, signZ + 0.0f);
glTexCoord2f(1.0f, 0.0f);
glVertex3f(signX + 128.0f, signY + 0.0f, signZ + 0.0f);
glTexCoord2f(1.0f, 1.0f);
glVertex3f(signX + 128.0f, signY + 128.0f, signZ + 0.0f);
glTexCoord2f(0.0f, 1.0f);
glVertex3f(signX + 0.0f, signY + 128.0f, signZ + 0.0f);
glEnd();

glDisable(GL_TEXTURE_2D);



glPopMatrix();

glEnable(GL_COLOR_MATERIAL);
}


Display function (if it helps solved the problem):


void display (void) {
//clear screen
clearScreen();

//set modelview
setModelView();

//load identity
glLoadIdentity();

//update
camera();
drawFloor();
drawSign();


glutSwapBuffers(); //swap the buffers
}

shawn619
07-24-2012, 10:56 PM
Solved!

Image files werent in the proper directory

V-man
07-25-2012, 04:58 AM
Solved!

Image files werent in the proper directory

So why don't you return an error message to the user that the image file is not found?

shawn619
07-25-2012, 10:54 AM
I,ll do that, thank you!