0

I generated a vbo buffer (vertex buffer) object called object_A, let's assume that object_A contains 10 vertices (30 floats). Now I want to update object_A using glMapBuffer with 20 vertices (60 floats), can I use glMapBuffer?

vallentin
  • 23,478
  • 6
  • 59
  • 81
Damons
  • 153
  • 1
  • 1
  • 7

1 Answers1

2

You can't use glMapBuffer(), that's just for mapping the buffer's data into client address space.

If you want to resize a buffer then you have to use glBufferData().

glBufferData(GL_ARRAY_BUFFER, 60 * sizeof(GLfloat), NULL, GL_DYNAMIC_DRAW);

If it's because you want something similar to realloc() (reallocating the buffer, keeping the old contents). Then you could utilize glCopyBufferSubData() and copy the data between buffers.

Benjamin Loison
  • 3,782
  • 4
  • 16
  • 33
vallentin
  • 23,478
  • 6
  • 59
  • 81