Reputation: 1513
I'm following this tutorial, to learn OpenGl es 2.0. Those informations (plus a lot of others tutorials) led me to this: vertices must be declared in an array, the array must be sent to the GPU memory with FloatBuffer operations, from there they must be picked up by openGL. What follows is a little bit obscure, to me. The question is: once the vertices are there (in the gpu memory) what part of a java program is meant to pick up these data? The shader and fragment code? The vertexattrib array commands?
Upvotes: 0
Views: 87
Reputation: 54572
The way OpenGL works on a very basic level, not much really happens until you issue a draw call, like glDrawArrays
or glDrawElements
. Most other calls just set up state that will be used by the draw calls. The most important parts of state are what you have already seen:
glVertexAttribArray
and related calls are used to specify the vertex data used for the draw call.glUseProgram
, and all the calls you use before that to build a program, specify what shaders will be run for your draw call.Once you have all this state set up, and issue a draw call, you set the whole machinery in motion. If you want to read up on details on everything that happens here, you should be able to find good material with search terms like "OpenGL rendering pipeline", or in any OpenGL book. Very roughly, the main steps are the following:
glVertexAttribArray
and related calls, and feeds that data into the vertex shader.attribute
variables, and processes it.There's more to it than what I listed here, but I hope this will help you understand the basics.
Upvotes: 1