hanek
02-19-2009, 04:16 AM
Hiall,
I have an obj. file for a simple cube exported from Blender,
where is the vertex data and faces data in which order vertexes are in a single face:
# Blender3D v248 OBJ File:
# http://www.blender3d.org
v 3.935551 -1.000000 -1.000000
v 3.932597 -1.000000 1.000000
v -1.000000 -1.000000 1.000000
v -1.000000 -1.000000 -1.000000
v 3.709118 -0.797889 -0.851264
v 3.728637 -0.725917 0.637501
v -0.749396 -0.730253 0.654301
v -0.776180 -0.718190 -0.887628
usemtl Material
s off
f 1 2 3 4
f 5 8 7 6
f 1 5 6 2
f 2 6 7 3
f 3 7 8 4
f 5 1 4 8
After parsing these values to an array or vertexes, how to draw it with OpenGL ES correctly using:
glVertexPointer( 3, GL_FLOAT, 0, vertices );
glDrawElements(GL_TRIANGLES, sizeof(triangels)/sizeof(GLubyte),GL_UNSIGNED_BYTE, triangels);
Does the vertex array writing data order matter?
How do i get the correct triangles, (not hardcoding them)? Do i need to calculate the triangles using face data or something?
Do some 3d file formats have triangle data ready if exported?
I have an obj. file for a simple cube exported from Blender,
where is the vertex data and faces data in which order vertexes are in a single face:
# Blender3D v248 OBJ File:
# http://www.blender3d.org
v 3.935551 -1.000000 -1.000000
v 3.932597 -1.000000 1.000000
v -1.000000 -1.000000 1.000000
v -1.000000 -1.000000 -1.000000
v 3.709118 -0.797889 -0.851264
v 3.728637 -0.725917 0.637501
v -0.749396 -0.730253 0.654301
v -0.776180 -0.718190 -0.887628
usemtl Material
s off
f 1 2 3 4
f 5 8 7 6
f 1 5 6 2
f 2 6 7 3
f 3 7 8 4
f 5 1 4 8
After parsing these values to an array or vertexes, how to draw it with OpenGL ES correctly using:
glVertexPointer( 3, GL_FLOAT, 0, vertices );
glDrawElements(GL_TRIANGLES, sizeof(triangels)/sizeof(GLubyte),GL_UNSIGNED_BYTE, triangels);
Does the vertex array writing data order matter?
How do i get the correct triangles, (not hardcoding them)? Do i need to calculate the triangles using face data or something?
Do some 3d file formats have triangle data ready if exported?