Advanced note related to vertex attribute arrays

(This note is of most interest to users of Java bindings to OpenGL.)

The glVertexAttribPointer function is used to tell the rendering engine where the start of vertex attribute data is. Of special note is the final parameter ("pointer") which is actually an integer offset from the start of the attribute array whose index is given by the first parameter. In OpenGL 2, the vertex attribute data could either be stored on the client side (in which case this final parameter was interpreted as an actual client-side memory address) or on the server side (in which case the parameter was interpreted as an integer offset from the start of the server-side array). Most OpenGL implementations allow backwards compatibility to previous OpenGL releases, the prototype for this final parameter continues to be declared as "const void*" in C/C++ bindings, and the multiple interpretations of this final parameter are preserved. While the "void*" mechanism and the type-casting it implies work fine in C/C++, Java's stricter type checking requires a different approach. Java implementations allow both interpretations of this final parameter by actually defining two different glVertexAttribPointer methods, one whose prototype declares the final parameter as an object reference, and one whose prototype declares the final parameter as an integer. If you are using the Java bindings, it is your responsibility to make sure the correct glVertexAttribPointer method gets called. Of particular note is the common case where we want the rendering engine to start at the beginning of the attribute array. In that case, we would pass 0 as the actual parameter. In C/C++ programs, it is not uncommon for programmers to pass nullptr (the formal parameter is void*, after all), and this works fine because the implementation has sufficient information in the Rendering Context to do its type cast. In Java bindings, however, a call with 0 as the final parameter invokes a different method than does a call with null as the final parameter! Therefore, when using Java OpenGL bindings, care must be taken when invoking this routine. For example, if you are using only server-side array storage (in keeping with OpenGL 3 and our treatment here), you should never pass null to a glVertexAttribPointer call.