0
votes

I am using openGL and "freeglut" library for volume rendering and display. In the main thread I initialize the openGL window, and then acquire volume data frame by frame, the volume rendering is done after one volume data is acquired. This works well but takes much time. Is it possible that I keep initializing openGL window in the main thread, and do the volume rendering and display in another thread? I have checked wglMakeCurrent, it does not update the window initialized in the main thread.

1

1 Answers

5
votes

Multithreaded OpenGL operation is a nasty beast. You can however, and this is what I strongly suggest, map a Pixel Buffer Object into the program's address space. And that region of address space is visible to all threads. So you can update the volume data from another thread (or, like in the case of the program I'm currently working on, on another GPU), then signal the main thread to update the texture from the new data in the PBO. You can also update only sub portions of the volume from the PBO with glTexSubImage3D.