I have successfully completed a OpenGL ES 1.1 app for Android and people seem to like it. Now I’m reading the book “Open GL ES 2.0 Programming Guide” and trying to learn about how to use shaders. I think I get most of it, but I’m confused on a few points.
In 1.1, it was pretty straightforward. I would send OpenGL my list of vertices, texture coords and normals, and then call glDrawElements() and my model would get drawn.
Now in 2.0, I can specify the Vertex Attributes, which include the vertices, texture coords and normals, and maybe more. Then I call glDrawElements() and specify the indices of the vertices of my triangles. This time, it is my vertex shader which understands which attribute is position, and then puts it in gl_position, which the frag shader will pick up and use.
What I’m confused about is whether I have to send the attributes every time I draw, or next frame (where perhaps the only thing different is the view matrix) do I only have to call glDrawElements() again with the indices? Do the Vertex Attributes persist?
Another question is, where do the primitives get clipped against the view frustum? Does my application have to be careful to only send primitives which are in the view for performance reasons, or would OpenGL clip them fairly early in the chain anyway, so I don’t need to work very hard at not sending triangles which have no chance of being in the view?
Thanks very much for any insight.
-Kevin