openscenegraph/osg — pull request #10 by aurelien35 (2013-05-23 10:19:36+00:00)
Title: Array dispatchers : add support for "normalize" parameter and more array data types

Hi,

Here is a submission to support more data types and binding in OSG when using vertex attributes (standard or user defined).

This should solve this issue :

http://forum.openscenegraph.org/viewtopic.php?t=11267&highlight=

(solved mine, but it is application-dependant since some data types/binding types/target attribute combinaisons are not supported by OpenGL and/or OSG)

There are 4 classes modified, from simpler to more complex :

1/ Drawable/Drawable.cpp :
=> more extensions are loaded

2/ State/State.cpp :
=> all VBO binding methods like "setVertexPointer" or "setNormalPointer" have a new parameter to select if the array is bound as a "normalized" array. This parameter is set by default to "GL_FALSE", except for colors, so they works just as before

3/ ArrayDispatcher/ArrayDispatcher.cpp :
=> the array dispatchers are now registered in the "_attributeDispatchList" vector as a pair : a function pointer for "unormalized" dispatch and a function pointer for "normalized" dispatch

=> all methods which return an arrayDispatcher have a new parameter : "normalized" which is set to default to "GL_FALSE", except for colors, so they works just as before

4/ Geometry.cpp :
=> the drawImplementation now take cares of the "normalized" for all array data.

In conclusion :
- BIND_OVERALL should now work in all situations where it should work (I mean supported by OpenGL and supported by OSG)
- when using byte, short or integer data arrays, the "normalized" parameter should be applied correctly