Opengl-es draw an .obj file, but how?
- by lacas
I d like to parse an .obj file. My parser is working good, but my displaying is not good.
Obj file is here
my code is:
public ObjModelParser parse() {
long startTime = System.currentTimeMillis();
InputStream fileIn = resources.openRawResource(resourceID);
BufferedReader buffer = new BufferedReader(new InputStreamReader(fileIn));
String line="";
Log.e("model loader", "Start parsing object " + resourceID);
try {
while ((line = buffer.readLine()) != null) {
StringTokenizer parts = new StringTokenizer(line, " ");
int numTokens = parts.countTokens();
if (numTokens == 0) continue;
String part = parts.nextToken();
if (part.equals(VERTEX)) {
Log.e("v ", line);
vertices.add(Float.parseFloat(parts.nextToken()));
vertices.add(Float.parseFloat(parts.nextToken()));
vertices.add(Float.parseFloat(parts.nextToken()));
....
and my displaying code is:
draw that model with TRIANGLE_STRIP and gl.glDrawArrays(rendermode, 0, coords.length/dimension);
What is the mistake here?
edited: file here to show what is my good coords from my program for a cube, and what is from .obj file, that never show
Thanks, Leslie