I am experimenting with vertices in Java. I tried to make a cube, but on the forward face it looks like a quarter piece is missing, I’m not sure what I’m doing wrong. since the code that renders is not mine and does work when the proper vertices and indices are given, I know it is something with my vertices or and/or indices.
I generated the vertices and indices from a wavefront OBJ file. Am I missing a set of indices??
this is the original OBJ file:
# Exported from Wings 3D 1.5.1
mtllib cube.mtl
o Cube1
#8 vertices, 6 faces
v -1.00000000 -1.00000000 -1.00000000
v -1.00000000 -1.00000000 1.00000000
v -1.00000000 1.00000000 -1.00000000
v -1.00000000 1.00000000 1.00000000
v 1.00000000 -1.00000000 -1.00000000
v 1.00000000 -1.00000000 1.00000000
v 1.00000000 1.00000000 -1.00000000
v 1.00000000 1.00000000 1.00000000
vn -0.57735027 -0.57735027 -0.57735027
vn -0.57735027 -0.57735027 0.57735027
vn -0.57735027 0.57735027 -0.57735027
vn -0.57735027 0.57735027 0.57735027
vn 0.57735027 -0.57735027 -0.57735027
vn 0.57735027 -0.57735027 0.57735027
vn 0.57735027 0.57735027 -0.57735027
vn 0.57735027 0.57735027 0.57735027
g Cube1_default
usemtl default
s 1
f 1//1 5//5 6//6 2//2
f 2//2 4//4 3//3 1//1
f 2//2 6//6 8//8 4//4
f 3//3 7//7 5//5 1//1
f 4//4 8//8 7//7 3//3
f 5//5 7//7 8//8 6//6
this is the vertices and indices code I am using in java.
final short[] _indicesArray = { 0,4,5, 4,5,1, 1,3,2, 3,2,0, 1,5,7, 5,7,3, 2,6,4, 6,4,0, 3,7,6, 7,6,2, 4,6,7, 6,7,5 };
final float[] vertices =
{
-1.00000000f,-1.00000000f,-1.00000000f,//0
-1.00000000f,-1.00000000f, 1.00000000f,//1
-1.00000000f, 1.00000000f,-1.00000000f,//2
-1.00000000f, 1.00000000f, 1.00000000f,//3
1.00000000f,-1.00000000f,-1.00000000f,//4
1.00000000f,-1.00000000f, 1.00000000f,//5
1.00000000f, 1.00000000f,-1.00000000f,//6
1.00000000f, 1.00000000f, 1.00000000f//7
};
This is what I see when it renders. I wasn’t allowed to display a screen shot so I had to draw it in text.
************************
* *
* *
* *
* *
* *
* ** *
* ** ** *
* ** ** *
* *** *** *
**** ****