OBJ parsing and texture mapping

Started by
12 comments, last by haegarr 13 years, 3 months ago

I'm sorry I'm down to wild guesses now:
Are you sure you don't need to call

glEnableClientState(GL10.GL_TEXTURE_COORD_ARRAY);

before

glTexCoordPointer(2, GL10.GL_FLOAT, 0, textureBuffer);



Nope, that has nothing to do with the problem.
Something else causes the problem. And it's driving me crazy.
Advertisement
You're welcome to send me a PM and contact me offline, I'll be glad to test it on my side.


Nope, that has nothing to do with the problem.
Something else causes the problem. And it's driving me crazy.

You're welcome to send me a PM and contact me offline, I'll be glad to test it on my side.


WoW, that'd be great! :)

Sending you the code for test.
Have you considered that OBJ uses multi-index mapping, while OpenGL supports only 1 index mapping? I.e., the following hypothetical extract from an OBJ
v x1 y1 z1
v x2 y2 z2
...
vt u1 v1
vt u2 v2
...
f 1/1 2/2 3/3
f 3/3 4/2 5/4
...
needs to be converted into
x1 y1 z1 u1 v1
x2 y2 z2 u2 v2
x3 y3 z3 u3 v3
x3 y3 z3 u3 v3
x4 y4 z4 u2 v2
x5 y5 z5 u4 v4
...
0 1 2 2 3 4 ...
when using triangle soup, interleaved mode and indices. Hence texture co-ordinates need to be duplicated and re-ordered to be used (as positions need to be, too) in dependence on the face index tuples. This is true even if using different streams for positions and texture co-ordinates. I don't have seen something like that in the posted snippets.

This topic is closed to new replies.

Advertisement