openframeworks/openFrameworks — pull request #3355 by tgfrerer (2014-10-23 18:57:51+00:00)
Title: refactor ofVbo - WIP - don't merge yet

I'm submitting this for discussion =)

## Motivation

We currently (as a legacy to fixed function GL) have two classes of vertex attributes, those we can set with methods like `setVertexData` and those we can set with `setAttributeData`. Because these are stored separately, and have different execution paths under the hood, it's very tricky to make sure not to eclipse built-in attributes when setting custom attributes. This also made it almost impossible to set 3D texture coordinates, without using OpenGL commands directly, for example.

This refactor fulfils the modern OpenGL promise that all attributes (but for the indices) are equal. It is backwards compatible with the current API, and the fixed function pipeline.

This should also make it easier to see what's happening under the hood for shader developers, since they can see which vbo attribute is mapped to which shader attribute position, and the connection between `ofShader` and `ofVbo` is made nore explicit.

## Items addressed by this PR
+ makes all fixed function helper methods (`setVertexData`, `setNormalData`, ...) pass through the same attribute pipeline to DRY execution paths
+ makes sure all attributes are cleared when calling `ofVBO::clear()` - this wasn't the case for custom attributes
+ automatically recognises default attribute positions (`ofShader:POSITION_ATTRIBUTE`, `ofShader::COLOR_ATTRIBUTE`, `ofShader::NORMAL_ATTRIBUTE`) to fixed pipeline when using utility methods or hand-setting attributes, and switches on `bUsingColors`, `bUsingNormals` as needed.
+ allows for 3D texture coordinates
+ triggers VAO changes on attribute changes (which wasn't the case).

## tests
+ tested on windows (fixed,programmable)
+ tested on osx (fixed, programmable)