Skip to main content
GameDev.net gamedev.net
🔒 Locked

Identify the pattern

Started by venkatdoss May 13, 2016 at 1:05 PM 1 replies 1.2k views
Original Post
venkatdoss
venkatdoss

Hi folks,

Is there any way to identify the pattern stored in the buffer (say VBO) from the call glVertexAttribpointer.

Whether it has pattern of

1) Vertices+ Normal +Color

(or)

2) Normal + Vertices + Color

(or)

3) Color + Vertices + Normal ...

Need this information to reply GL API sequence.

Regards,

Venkatesh

21st Century Moose
21st Century Moose

No.

For example, both normal and position are typically stored as 3-component float arrays. So given an arbitrary 3 floats, there is no way to tell if they're intended to be interpreted as normal or position.

This is entirely the point of glVertexAttribPointer.

The documentation for both glVertexAttribPointer and glEnableVertexAttribArray refers to "generic vertex attributes"; i.e. the vertex attributes themselves are generic and they have neither metadata, not usage semantics, nor anything else attached to them to denote how they are used. How they are used is entirely determined by your program.

"Generic" in this case even goes a step further in that you are not confined to the typical attributes used in drawing (position/normal/texcoords/colours/etc): if you want your program to interpret an attribute as "kilowombles per square inch", you can.

Direct3D has need of instancing, but we do not. We have plenty of glVertexAttrib calls. 
Juliean
Juliean
Is there any way to identify the pattern stored in the buffer (say VBO) from the call glVertexAttribpointer.

As said, you cannot do that directly. If you have control over the source, you can make a wrapper instead of calling glVertexAttribpointer directly, and add the desired information. If not you can maybe identify the shader that is being loaded and manually determine what combation of attributes it requires (just to mention it).

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.