As per my previous question, it seems it would be desirable to use more than a single VBO in my OpenGL program. But I've hit a wall when trying to do this. Currently my main function looks something like this in pseudocode
setup "main" VBO and VAO
load shaders
setup shader attributes
while true
update geometry into "main" VBO
glBufferData(... "main" VBO)
glClear(GL_COLOR_BUFFER_BIT)
glDrawArrays(...)
Now what I thought I could do is effectively move the setup "main" VBO inside the game loop itself
setup VAO
load shaders
setup shader attributes
while true
setup "main" VBO
update geometry into "main" VBO
glBufferData(... "main" VBO)
glClear(GL_COLOR_BUFFER_BIT)
glDrawArrays(...)
which would then allow me to split the loop into multiple chunks, each creating its own VBO and drawing. But this doens't seem to work, and I get a blank white screen. I can only guess this is because the shaders are not only bound to the VAO, but also to the currently active VBO? I've tried glUseProgram()
after the "main" VBO setup, but it doesn't seem to help.
I've found it quite difficult to find information regarding which phase exactly depends on which, and in what order things need to be executed.