Hello!
I am using jogl and java to rewrite my c++ code to java. The problem is with drawing model read from file. I am using glDrawElements like this:
gl.glDrawElements(GL.GL_TRIANGLES,ibuf.capacity()/3,GL.GL_UNSIGNED_INT,ibuf); //ibuf - Index buffer.
In the above code I have to use GL_UNSIGNED_INT though in java we only have signed int, but when I change it to GL_INT nothing is drawn. So this is how I do “drawing”. Of course I am calling rewind() for each buffer. Each buffer is created like this:
ibuf = BufferUtil.newIntBuffer(fnum*3);
Now is the strange part. When I ran my program I saw this result:
http://iis.pwsz.elblag.pl/~iis7043/tiny.jpg
Then when I ran it again after after changing something small in code, like zFar in gluPerspective from 2000 to 3000 (I does not affect the drawing) the result was:
http://iis.pwsz.elblag.pl/~iis7043/tiny1.jpg
I changed nothing in the drawing part of code! Each time program is rad, the result is different. though everything is the same!
Please help!
I am using:
jogl-1.1.0
java version “1.6.0_04”
Linux, openSUSE 10.3
PS: I am writing this post, because I’ve been “googling” for few hours with no results.