Menu

#1 GL Crash, no error

v1.0_(example)
open
nobody
5
2010-06-04
2010-06-04
Tony O
No

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);
}

Discussion

  • Tony O

    Tony O - 2010-06-04

    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.

     
  • Tony O

    Tony O - 2010-06-04
     
  • Tony O

    Tony O - 2010-06-04
     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.