Pivonka

05-17-2017, 01:23 PM

Motivation:

There are principally 2 basic ways how to organize vertex attributes in OpenGL buffers.

1. Interleaved - for each vertex all attribute types are grouped together, example: (VNCVNCVNCVNCVNC)

2. Separated - for each attribute type all vertices are grouped together, example: (VVVVVNNNNNCCCCC)

Just for explanation - V stands for vertex position (coordinate vector), N stands for vertex normal (normal vector), C stands for vertex primary color (color vector). This description is used in OpenGL wiki article "Vertex Specification Best Practices" at https://www.khronos.org/opengl/wiki/Vertex_Specification_Best_Practices#Formatting_VBO _Data.

Question:

Is it possible to reach such a level of vertex attribute separation where I can group even components of mentioned vectors together? In other words, I need to delivery to the OpenGL engine the x-components of all vertices as a continuous series first, followed by continuous series of y-components, etc. The reason is that I have got the raw data in that form and I don't want to rearrange it, as it is crazily expensive, naturally.

Examples:

(VxVxVxVxVxVyVyVyVyVyVzVzVzVzVzVwVwVwVwVw) - for each coordinate component [x,y,z,w] all vertices are grouped together

(CrCrCrCrCrCgCgCgCgCgCbCbCbCbCbCaCaCaCaCa) - for each color component [r,g,b,a] all vertices are grouped together

There are principally 2 basic ways how to organize vertex attributes in OpenGL buffers.

1. Interleaved - for each vertex all attribute types are grouped together, example: (VNCVNCVNCVNCVNC)

2. Separated - for each attribute type all vertices are grouped together, example: (VVVVVNNNNNCCCCC)

Just for explanation - V stands for vertex position (coordinate vector), N stands for vertex normal (normal vector), C stands for vertex primary color (color vector). This description is used in OpenGL wiki article "Vertex Specification Best Practices" at https://www.khronos.org/opengl/wiki/Vertex_Specification_Best_Practices#Formatting_VBO _Data.

Question:

Is it possible to reach such a level of vertex attribute separation where I can group even components of mentioned vectors together? In other words, I need to delivery to the OpenGL engine the x-components of all vertices as a continuous series first, followed by continuous series of y-components, etc. The reason is that I have got the raw data in that form and I don't want to rearrange it, as it is crazily expensive, naturally.

Examples:

(VxVxVxVxVxVyVyVyVyVyVzVzVzVzVzVwVwVwVwVw) - for each coordinate component [x,y,z,w] all vertices are grouped together

(CrCrCrCrCrCgCgCgCgCgCbCbCbCbCbCaCaCaCaCa) - for each color component [r,g,b,a] all vertices are grouped together