Loading 2 models into a vector or hashtable and then drawing will crash and hard quit the application:
Same models work fine when only declaring a single TDModel. I was thinking maybe a static var somewhere is changed but could not find one.
If I declare 2 separate TDModel objects and load models (same model or different models produce same results), the first .draw(gl) will fail with Exception: java.lang.ArrayIndexOutOfBoundsException: remaining() < count
Please let me know what other data is needed.
Relevant code:
private Hashtable<Integer, TDModel> scene = new Hashtable<Integer, TDModel>();
scene.put(scene.size(), parser.parseOBJ("/data/data/com.openGL/cube.obj"));
scene.put(scene.size(), parser.parseOBJ("/data/data/com.openGL/cube.obj"));
for(Integer objP : scene.keySet()){
//gl.glTranslatef(cameraX, cameraY, cameraZ);
scene.get(objP).draw(gl);
}
More info since I'm not going to bed as early as planned.
.draw() call is throwing ArrayIndexOutOfBoundsException on line:
gl.glDrawElements(GL10.GL_TRIANGLES,t.getFacesCount(),GL10.GL_UNSIGNED_SHORT,t.getFaceBuffer());
t.getFacesCount() gets a seemingly valid value (432 for my obj) but t.getFaceBuffer().capacity is 108. I'm not super familiar with java but since I'm seeing those as being 4 bytes and 108*4=432 I'd assume that is also correct; from the error (remaining() < count) I figured I'd mention it.