Hello,
This must be a newbie question,but sorry, I could’nt find the answer.
I’m using vertex3f to draw a sphere composed of triangles. I thought using vertex3fv since i have a lot of triangles but I don’t know how to put the array in the int attribute of vertex3fv.
Could you tell me How to do that or where can I find an example, plz.
Thks a lot…
Franck
The int parameter is the address of a buffer, in this case a FloatBuffer. You’ll probably want to read up on them at java.sun.com, but here’s a fragment to get you started:
import org.lwjgl.Sys ;
import java.nio.* ;
FloatBuffer v1 = ByteBuffer.allocateDirect(4 * 3).order(ByteOrder.nativeOrder()).asFloatBuffer() ;
int v1_addr = Sys.getDirectBufferAddress(v1) ;
v1.put(10.0f).put(5.0f).put(23.0f) ;
gl.vertex3fv(v1_addr) ;
The extra imports you may need are listed. The size allocated (4 * 3) is because you have three components (it’s a vertex3f) and floats are 4 bytes in size.
Most methods called on buffers will return a reference to the buffer itself, so you can chain methods together as above.
Hope that helps.
That’s exactly what I was looking for
tks cfmdobbie
Franck
It’s also the second slowest way to draw triangles there is 
Cas 
I suppose so.
But i’m just starting to learn opengl, so I think i’ll learn more later instead you give me a hint :-*
Ok, well don’t use glVertex3fv! It’s vastly over complicated and very slow. In fact I thought it was so useless I left it out of the first alpha because I didn’t think anyone would want to use it!
Stick to glVertex3f, because it’s much easier, and approximately the same speed. And it’s blindingly fast in a display list. If you’re going to muck around with pointers then you’ve really got to use vertex arrays which are much, much faster for any non-trivial number of polygons, but again, too fiddly for just a few.
Cas 