possible bug with VBO registering and multiple openGl context


I fought against a weird bug this week and I need some opinion to know if my workaround is valid

and if I should send a bug report about this or if its just me…

My problem occurs with either cudaGraphicsGLRegisterBuffer() and the now deprecated cudaGLRegisterBufferObject().

The function is returning an ‘out of memory’ code error (although there is plenty of it) under these circumstances:

Error If I use the VBO as follow and try to register after:


glVertexPointer(3, GL_FLOAT, 0, 0);


My workaround


glVertexPointer(3, GL_FLOAT, 0, 0);


glVertexPointer(3, GL_FLOAT, 0, 0);

Note that I can use anyway I want the VBO if one of these conditions isn’t true:

  • using multiple opengl context (they share VBO PBO with an intermediate context, I’m using QT and QGLWidget to get multiple viewports)

  • registering occurs outside the display loop (keyboard event for instance)

If I register inside the display loop then no error occurs the same is true if I only use a single viewport.

Last comments: I’ve made sure that I’m making current the correct gl context before registering, openGl context is set before cuda context.

The problem occurs exclusively under linux and not windows, I also Have the same problem with my optimus laptop and two worstations.

Any ideas? Should I report this?


Just to be absolutely clear, what exactly do the functions vbo->bind() and vbo->unbind() do?

Typically, we bind VBO’s, draw, and then clean up any left over bindings as is done in the following snippet for each frame to be rendered. Each VBO is only registered across CUDA/GL once before any drawing takes place with cudaGraphicsGLRegisterBuffer.

// bind vbo, set vertex pointer                                                                                                                                                                                                   

glBindBufferARB(GL_ARRAY_BUFFER_ARB, vbo);

glVertexPointer(3, GL_FLOAT, 0, 0);

// draw






// cleanup

glBindBufferARB(GL_ARRAY_BUFFER, 0);

vbo->bind(); does only glBindBuffer(GL_ARRAY_BUFFER, some_vbo_id); and vbo->unbind() glBindBuffer(GL_ARRAY_BUFFER, 0);

So in my case the clean up is not sufficient I have to add the glVertexPointer(3, GL_FLOAT, 0, 0); after the unbind!
Also I can assure the problem is not due to calling cudaGraphicsGLRegisterBuffer twice on the same buffer object.

thank you for showing interest in my problem :)