Re: VAO and VBO creation
Posted by
jmaasing on
May 29, 2015; 10:51am
URL: https://forum.jogamp.org/VAO-and-VBO-creation-tp4034542p4034544.html
You can look at the tutorials. For example Wade Walker has a tutorial about VBOs
http://jogamp.org/wiki/index.php/Jogl_Tutorial#Wade.27s_JOGL_tutorialsMaybe the demo source can be of help:
http://jogamp.org/git/?p=jogl-demos.git;a=tree;f=src/demos;hb=HEADThey will show you how you get an instance of a GL interface to call GL-methods.
But basically you allocate an int array on the java side. Then pass that array to genVertexArrays. OpenGL will create a new 'name' for that VAO and fill in the array with the 'name' (OpenGL uses numbers for names - one of the many strange things about OpenGL). Like this:
final int[] vas = new int[1];
gl.glGenVertexArrays(this.vas.length, this.vas, 0);
final int[] vbos = new int[numberOfBuffers];
gl.glBindVertexArray(this.vas[0]);
gl.glGenBuffers(this.vbos.length, this.vbos, 0);