View Full Version : how to get VERTEX_ATTRIB_ARRAY_DIVISOR_ARB ?

01-06-2012, 11:28 AM
I'm trying to poll the state for 'GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ARB', which comes from the extension "ARB_instanced_arrays (http://www.opengl.org/registry/specs/ARB/instanced_arrays.txt)".

The spec says to use the function 'GetVertexAttribiv', but I believe 'GetVertexAttribiv' only exists when compiling against 2.1 headers. I'm on Windows at the moment and GL.h does not have that function listed, so I need to know which extension provides the function poll the state.

I thought the extension "EXT_gpu_shader4 (http://www.opengl.org/registry/specs/EXT/gpu_shader4.txt)" might provide the right API entry point to get the state, but glext.h (http://www.opengl.org/registry/api/glext.h) surprisingly does not list all the prototypes that the spec adds. Anyway, the "divisor" is probably not a shader attribute, so this extension is probably not the right one to use.

Can someone tell me how to get the 'GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ARB' state on Windows? Thanks for any tips.

carsten neumann
01-06-2012, 11:54 AM
The glext.h you linked in your post declares glGetVertexAttrib{d,f,i}vARB() as part of extension GL_ARB_vertex_program.

01-06-2012, 01:38 PM
Thanks for spotting that!

I'm unsure what is the 1st parameter (index) to be passed to "glGetVertexAttribivARB"? If that is the right function to use, it would appear as though the 'divisor' is actually a vertex attribute.

I had assumed the divisor is not actually an attribute, but maybe it is. I'll have to get some code together to find out if the divisor shows up when I enumerate all the attributes with "glGetActiveAttribARB".

Do you think it be listed as one of the attributes so that I can use "glGetVertexAttribivARB" to know the state of the divisor?

Thanks again.

carsten neumann
01-06-2012, 01:57 PM
I don't think it's a vertex attribute, rather it is a property of a vertex attribute. It seems to me that you could set different divisors for say vertex attrib 0 (e.g. position) and vertex attrib 1 (e.g. normal).
So the first argument to glGetVertexAttrib() would be which vertex attrib's divisor you want to query.