From: Kenneth B. R. <kbr...@al...> - 2003-03-28 16:12:57
|
> From: Andy Lubbers <do...@ya...> > > Has anyone sucessfully used a direct > java.nio.ByteBuffer in a glVertexPointer > statement. I have been able to get something > drawn on the screen if i pass a float[] into > glVertexPointer, but nothing shows up if I pass a > Buffer into it. Yes. See http://java.sun.com/products/jfc/tsc/articles/jcanyon/ ; links to the source code are near the bottom of the page. It's probably the byte ordering; you need to call ByteBuffer.order(ByteOrder.nativeOrder()) when your ByteBuffer is first created. I have made this mistake in 100% of my own java.nio programs which is why I recommend making a BufferFactory class which does it up front; see the slides of http://servlet.java.sun.com/javaone/sf2002/conf/sessions/display-3167.en.jsp -Ken |