Hello,
i a new to OpenGL (ES) and have difficulties understanding when to do which system call in order to get the things done.
More precisely, i want to draw Triangles using glDrawElements with Vertex Buffer Objects. I do something like this:
---------- Initialization -------------
#Load Shaders
#Attach Shaders to Program
#BindAttributeLocation of a Position Attribute in the Vertex Shader
#Link Program
#use Program
#Generate GL_ARRAY_BUFFER Buffers
#Load Vertex Information using glBufferData
#Call glVertexAttribPointer for the Position attribute
#Generate GL_ELEMENT_ARRAY_BUFFER Buffers
#Load Indexes Information
------- Draw Routine ---------------
#Call glClear
#Call glEnableVertexAttribArray on the Position Array
#Call glDrawElements
#Call eglSwapBuffers
Thats a order to do things that seem to work. But i dont get why for example i have to call glEnableVertexAttribArray every time before doing the drawing with glDrawElements, althoug i dont touch any buffer. Same thing with the glVertexAttribPointer() call in the Initialization phase. If i move the call before the generation of VOB, i get a segment fault.
It may be obvious when to call when with deeper insight in OpenGL, but for me this things almost look random. If for example i want to change a vertex buffer and not touch the rest, do i have to to load the other buffers as well, do i have to specify glVertexAttribPointer()?
Thank you very much!