Skip to main content
Tweeted twitter.com/StackGameDev/status/1021908146338623491
edited tags; edited title
Link
user1430
user1430

What happens to BufferOpenGL buffer data that isn't used?

Source Link

What happens to Buffer data that isn't used?

I have a vertex struct that has 5 glm::vec3 but some of my objects only use 2 or 3 of those members. So I have two questions :

1.) What happens to the large buffer I create, even though I don't use all the data.

Struct Vertex {
          glm::vec3 pos, color, UV, normal, tangent
              };
std::vector<Vertex> vertices; // will store the vertex data
glBufferData(GL_ARRAY_BUFFER, vertices.size() * sizeof(Vertex), vertices.data(), GL_STATIC_DRAW);

That creates a buffer that is larger than needs to be. Is the additional buffer data not send?

2.) If I send empty data to the buffers, is it causing any performance issues?

glVertexPointer(2, 3 , GL_FLOAT, GL_FALSE, size of(Vertex), reinterpret_cast<GLvoid*>(Offsetof(Vertex, unusedData)); 

Thanks for the information!