PDA

View Full Version : Same vertex different texture coordinates



Victor Hugo
05-15-2009, 06:50 AM
Hi All,

I'm a bit confusing about loading some of my OBJ files.

I'm programming to OpenGLES 1.1, so I use glDrawElements to render my models.

However, to specify the vertex, normals and texture coordinates I use :

glVertexPointer, glNormalPointer and glTexCoordPointer.

But using this functions, I assume that I need a relation between vertex - normal - texture coordinate, of one to one.

But, some of my models, they have faces that share the same vertex but with different texture coordinates.

IS this normal to happen ? What should I do ? Duplicate the vertex ?

Thanks in Advance,

Victor

Xmas
05-15-2009, 07:50 AM
Yes, you have to duplicate such vertices.

Victor Hugo
05-15-2009, 08:00 AM
Hi Xmas,

Thanks for the help.

That is the only way right ?

Or I'm doing something wrong ?

Thanks,

Victor

dletozeun
05-15-2009, 09:16 AM
Yes this is the only way since vertex, texture coordinates, normals,... are indexed with the same index buffer.

Consequently, you have to insert in your vertex array enough vertices for all combinaitions of (vertex, normal, texture coordinates).

Victor Hugo
05-15-2009, 10:10 AM
Ok

Thanks you all for the help. Understood now :)