im trying to load and render a model with ogl.
well the model its a simple directx .x file.
simple because it is only 1 static mesh.
in my code i have writed a loader for x models, at the moment all what i need are vertex + textures coordinates.
i render it like like a simple directx mesh, but the texture coordinates are wrong.
for example if u look at this image you see on the left (black background) the right model , it display “MP” correctly.
on the right it is my scene( blue background ) and it display “PM”, like in a mirror,
image:
http://space.tin.it/clubnet/aglare/textureerror.jpg
at the moment my main code ( where im suspicious to have an error ) is here :
this piece is for render a model, look at the line:
“glTexCoord2f(x,-y);”
i really think the error is here “-y” ,
for(i=0;i<nfaces;i++)
{
glBegin (GL_POLYGON);
for(j=0;j<faces[i].nfacesvertexindex;j++
{
a=vertices[ faces[i].facesvertexindex[j] ].x;
b=vertices[ faces[i].facesvertexindex[j] ].y;
c=vertices[ faces[i].facesvertexindex[j] ].z;
x=texturecoords[faces[i].facesvertexindex[j]].u;
y=texturecoords[faces[i].facesvertexindex[j]].v;
/error here i think /e’ giusto -y ?/
glTexCoord2f(x,-y);
printf("texture : %f %f
",x,y); glVertex3f (a,b,c);
printf("vertici : %f %f %f
",a,b,c);
};
glEnd();
};
thx in advance
PS:do you know where i found the model ? ( great game !!!)
[This message has been edited by honny (edited 04-27-2003).]