0
votes

I'm trying to import an obj for my game program in LWJGL. I got my game to load the texture coordinates and vertices fine, the vertices render fine but the texture coordinates are all weird. I found out that the texture coordinates are larger than the texture itself, which means it will repeat, but I don't know how to scale the texture coordinates or anything to get them smaller than the texture itself and map correctly.

for(int i=0;i<Test.drawingVertices.length;i++)
{
  glTexCoord2f((Test.drawingTexCoords[i].x),(Test.drawingTexCoords[i].y*-1.0f));glVertex3f(Test.drawingVertices[i].x,Test.drawingVertices[i].y,-10-Test.drawingVertices[i].z);
}
1

1 Answers

2
votes

Texture coordinates are normalized meaning they are defined from 0.0,0.0 to 1.0,1.0. Here is a picture showing this. That is how you should define them.

http://i.stack.imgur.com/WKyLR.gif (can't post images because of low rep)