Textures not drawed on all polygon's faces

Hi folks,
after incredible troubling with Microsoft compilers, I finally could link opengl and glut libraries by using lcc.
Now I have this problem: I defined a cube, loaded a texture into memory, but the texture is being applied on only two faces of the cube: on the other 4 faces is drawed a texture similar to a code-bar (parallel tick lines of the same texture’s colors). Here I post the code:

typedef struct {
vertex_type vertex[MAX_VERTICES];
polygon_type polygon[MAX_POLYGONS];
mapcoord_type mapcoord[MAX_VERTICES];
int id_texture;
} obj_type, *obj_type_ptr;

obj_type cube = […vertex,polygon & mapcoord initialization…]

//the LoadBitmap2 function returns the number of the texture, 1 in this case because I only use 1 texture.

I think this behaviour is quite strange, or maybe it’s only a lack of experience on OpenGL ?

i think you have assigned wrong texture coordinates to those faces. a code-bar is what you get if the texture coordinates are constant into one direction. for a simple quad face, it should look something like

glTexCoord2f(0.0, 0.0); glVertex3f(-1.0, -1.0, 0.);
glTexCoord2f(1.0, 0.0); glVertex3f( 1.0, -1.0, 0.);
glTexCoord2f(1.0, 1.0); glVertex3f( 1.0, 1.0, 0.);
glTexCoord2f(0.0, 1.0); glVertex3f(-1.0, 1.0, 0.);

Tnx a lot, that was the problem

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.