PDA

View Full Version : yet another problem with texture mapping



fredoule
05-01-2002, 04:52 AM
Hi,

I'm trying to do some texture mapping on some quads and triangles but no texture seems to be mapped on my objects.

I'm using the Paul's tgaloader, and i think i'm using the same properties for blending, smoothing,lighting,... as the 5th paul's tutorial.

But my program has 2 screens with gluortho2D plus a 3D window.

Does it come from my program features or did i make a huge mistake ?

thx

Robbo
05-01-2002, 05:12 AM
Post us a little code. Do you have texture 2d enabled? Does it work if you just have texturing enabled (without blending) - are your primitives black or whatever?

More information required.

fredoule
05-01-2002, 05:33 AM
I tried without blending and it still doesn't work

GLUT_TEXTURE_2D is enabled

some sample:

void traceRectangle(GLuint nom, GLuint x, GLuint y, GLuint scale, float* couleur)
{
GLfloat rect_scale = 7 ;

glEnable(GL_TEXTURE_2D);
glDisable(GL_LIGHTING);

if (Sel_mode==GL_SELECT)
glLoadName(nom);


glTranslatef(x, y, 0.0);


glScalef(scale/rect_scale, scale/rect_scale, scale/rect_scale);

if (nom == __PLANCHE)
glBindTexture(GL_TEXTURE_2D, texture_id[1]);
else
glBindTexture(GL_TEXTURE_2D, texture_id[2]);


glBegin(GL_QUADS);
glColor3f(couleur[0], couleur[1], couleur[2]);
glTexCoord2f(0.0, 0.0); glVertex2f(-1.0, -0.5);
glTexCoord2f(1.0, 0.0); glVertex2f(1.0, -0.5);
glTexCoord2f(1.0, 1.0); glVertex2f(1.0, 0.5);
glTexCoord2f(0.0, 1.0); glVertex2f(-1.0, 0.5);
glEnd();

glEnable(GL_LIGHTING);

glDisable(GL_TEXTURE_2D);
}