OpenGL streaming from multiple windows

by Aspiring Game Dev   Last Updated March 27, 2015 07:04 AM

I am using GLUT library for my research/game.

In my game I have 25 windows created using glutCreateWindow(title), and each of them have their own display callback registered using glutDisplayFunc(Draw).

I am trying to stream the screen of each of the 25 windows on my computer to another client which will do some processing with all the screen capture of the 25 windows.

Currently I am capturing the screen of each of the 25 windows with:

glReadPixels(0,0,Xres,Yres,GL_RGB,GL_UNSIGNED_BYTE,pixels);

Just doing the call to glReadPixels for each of the 25 windows slows my fps down to 7 fps.

However I require the fps to be at least 25 FPS, is there any way I can improve the fps?



Answers 1


I found a solution to this.

Conventional glReadPixels() blocks the pipeline and waits until all pixel data are transferred.Then, it returns control to the application.

Thus we can overcome this by making glReadPixels() asynchronous .

glReadPixels() with Pixel buffer object (PBO) can schedule asynchronous DMA transfer and returns immediately without stall.

Read more here : https://www.opengl.org/wiki/Pixel_Buffer_Object

For even better performance, you can even implement double or triple PBO layers.

I read through many sites and found that this site has the most detailed and easy to implement details: http://www.songho.ca/opengl/gl_pbo.html

Aspiring Game Dev
Aspiring Game Dev
March 27, 2015 09:57 AM

Related Questions


Video recording and editing for game promo video

Updated June 29, 2017 20:13 PM


Unity - get screenshots from various resolutions

Updated August 24, 2017 21:13 PM