Obj problem....

Hi all!..i’m have an problem with texturing my model…
So i’m make model in 3ds max and exporting her into obj format with normals and texture coordinates…
hmm…but when model is loaded i’m see the model and shadows…but model has wrong textured :’(…
see that :

for example i texturing the quad…
You see the quad is good textured but…the car is only red color…please help me!!!
of couse this is a fragment of some code for draw the car^

 
            gl.glEnableClientState(GL.GL_VERTEX_ARRAY);
            gl.glEnableClientState(GL.GL_TEXTURE_COORD_ARRAY);
            gl.glEnableClientState(GL.GL_NORMAL_ARRAY);

            gl.glTexCoordPointer(2,GL.GL_FLOAT,0,t);
            gl.glNormalPointer(GL.GL_FLOAT,0,n);
            gl.glVertexPointer(3,GL.GL_FLOAT,0,v);

            gl.glDrawElements(GL.GL_TRIANGLES, vIndex.length, GL.GL_UNSIGNED_INT, indexes);

            gl.glDisableClientState(GL.GL_VERTEX_ARRAY);
            gl.glDisableClientState(GL.GL_TEXTURE_COORD_ARRAY);
            gl.glDisableClientState(GL.GL_NORMAL_ARRAY);

m.b. its all whrong textured because model has:
verts: 7332
normals: 7332
texture_verts: 6074 ???

I think there is probably something wrong with loading your .obj file since obviously you don’t have the correct numbers of texture coordinates. Make sure that you understand the way opengl handles vertex buffers and indices. One index represents a collection of a vertex, normal, texture coordinates, vertex attributes (etc, not all are required, it depends on your desire). Anyway this means that for a cube, you actually get 24 indices if you want it to remain faceted because each visible coordinate really has 3 normals associated with it. Anyway, this might be the cause of your problem. Or it might be that your loader is broken and it thinks it has all of the wrong texture coordinates and sets them to (0,0), in which case you’d get a single color.

I think the problem may be in indexes…becase index of vertex = index of normal for example: 6/16/6
where 6 and 6 is vertex and normal coordinates, but texture index is maybe wrong, as I think, i’m must rebuild array of texture coordinates, it maybe rigth??? ::slight_smile:
is this must be looks as 6/6/6…and model will be right textured??? :slight_smile:

hmm…may be…may be…ok! i will relook from debugger my tex coordinates…or…or i will rebuild tex array… :-\

yes! some error was in reading tex coordinates…but i’m think i must rebuild array… :-\