I built an OBJ to JavaFX triangle mesh parser and imported the monkey head sample model from blender but it doesn't render correctly. It almost seems to have a wallhack like effect. This link has the obj I'm trying to import as well as a video showing the problem. Link. This is the code I'm using.
if(tmp.startsWith("v ")) {
split = tmp.split(" ");
verticies.add(Float.parseFloat(split[1]));
verticies.add(Float.parseFloat(split[2]));
verticies.add(Float.parseFloat(split[3]));
} else if(tmp.startsWith("f ")) {
split = tmp.split("f |/\\d*/\\d* *");
faces.add(Integer.parseInt(split[1]) - 1);
faces.add(Integer.parseInt(split[2]) - 1);
faces.add(Integer.parseInt(split[3]) - 1);
if(split.length > 4) {
faces.add(Integer.parseInt(split[3]) - 1);
faces.add(Integer.parseInt(split[4]) - 1);
faces.add(Integer.parseInt(split[1]) - 1);
}
}