• Advertisement
Sign in to follow this  

Identify the pattern

This topic is 709 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
Advertisement

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.

Share this post


Link to post
Share on other sites
       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).

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement