Search code examples
openglpyopengl

Are buffers shared between two GLSL programs?


In my app, I need to switch between two GLSL programs through glUseProgram(program). I am wondering if I write:

glUseProgram(program1)
buf1 = glGenBuffers(1)
glUseProgram(program2)
buf2 = glGenBuffers(1)

Can buf1 and buf2 be the same value? i.e. does each program have its own buffers or does they share buffers?


Solution

  • Creating buffer objects is in no way affected by the current program. So calling glUseProgram has no effect on the creation of buffer objects. They are not associated with any programs that are in use.