0

I am initializing a object with following code.

std::vector<float> topRightBevelData = draw_circular_bevel(rightWidth, rightHeight, rightTopBevel, 1, 1, iSegmentsRightTop);
glGenVertexArrays(1, &m_VAOTopRightCircle);
glGenBuffers(1, &m_VBOTopRightCircle);
glBindVertexArray(m_VAOTopRightCircle);
glBindBuffer(GL_ARRAY_BUFFER, m_VBOTopRightCircle);
glBufferData(GL_ARRAY_BUFFER, topRightBevelData.size() * sizeof(float), &topRightBevelData[0], GL_DYNAMIC_DRAW);

Than i would keep updating the VBO.

std::vector<float> topRightBevelData = draw_circular_bevel(xWidth / 2.0, 0.0, 0.0, rightWidth, rightHeight, rightTopBevel, 1, 1, iSegmentsRightTop);

    glBindBuffer(GL_ARRAY_BUFFER, m_VBOTopRightCircle);
    glBufferSubData(GL_ARRAY_BUFFER, 0 ,topRightBevelData.size() * sizeof(float), &topRightBevelData[0]); 

Sometimes the data updating the vbo would be larger than the size of VBO , in that case can i increase the size of VBO ?

Summit
  • 2,112
  • 2
  • 12
  • 36

1 Answers1

1

[...] can i increase the size of VBO ?

No. The size of a buffer (like a Vertex Buffer Object) is immutable. If you need a buffer with a greater size, then you have to recreate the buffer object by glBufferData.

I recommend creating a buffer that is large enough when initializing.

Rabbid76
  • 202,892
  • 27
  • 131
  • 174