Jump to content
  • Advertisement
Sign in to follow this  
ziashan

OpenGL glReadPixels() Performance Issue

This topic is 2151 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am taking screen captures of an OpenGL application in real-time using glReadPixels() and experiencing a performance issue. I've followed the advice provided here:
http://www.gamedev.n...g-glreadpixels/

and here:
http://www.gamedev.n...screen-capture/

where samoth had the excellent suggestion to use PBO's, so I implemented his approach based on the information provided here:
http://www.songho.ca...ngl/gl_pbo.html

This works great on a Windows 7 system with AMD FirePro M5950 graphics and a very old Ubuntu 12.04 system with Radeon RV250 [Mobility FireGL 9000] graphics, but chokes on new Ubuntu 12.04 system with integrated Intel graphics. glReadPixels() takes >600ms to return even though (as I understand it) it should return immediately due to the asynchronous PBO use. I'm using GLEW for the OpenGL extensions and it appears that the graphics drivers support the GL_ARB_pixel_buffer_object extension. Any ideas? somoth mentioned that supplying wrong PBO flags can cause stalls, but i don't know what those might be.

Share this post


Link to post
Share on other sites
Advertisement
"but chokes on new Ubuntu 12.04 system with integrated Intel graphics"
Maybe i'm jaded, but whenever i encounter the words intel and integrated, I move on, and never look back :)

they aren't very strong GPUs, they're full of driver issues and implementation variances.. sometimes it will outright lie to you (glGet*)
however! Newer intel integrated chips have orders of magnitude better openGL support! all the way up to 4.1 from what ive read!
So, personally, I will be waiting until "a larger percentage" of my potential audience has newer intel chips, and continue to pretend the older ones never existed :)

This post is only a warning, that if you really want to support the older intel integrated chips, you are in for a potential nightmare...
I'm sure there are plenty of people who can help you, since many if not most people who aren't making hobbyist games, will choose to include the widest audience possible =)

edit: to actually be helpful,
what happens when you supply an opengl implementation with something it doesn't support may cause it to run it in software mode
which is many orders of magnitude slower than hardware accelerated paths =)
for example, i imagine that if you tried GL_RGBA16 or GL_RGBA16F, it would do it all on the cpu
it may also not support RGB8, but i can't answer concretely what it can and can't do, and i'm unsure if you can ask the driver whether or not it's emulating it or not =)

http://www.opengl.org/wiki/Common_Mistakes#Texture_upload_and_pixel_reads
note that using GL_RGBA is not a "real format" because it doesn't describe internal precision, using GL_RGBA8 was determined to be the fastest.. i was unable to find any information for intel cards
Edited by Kaptein

Share this post


Link to post
Share on other sites
I would double check your format of your PBO and make sure that it matches the frame buffer that you're reading from. I've noticed significant performance hits if openGL needs to convert from the framebuffer's format to the PBO's format. Sometimes when you request a framebuffer format, you don't always get what you asked for.

Cheers,

Bob

Share this post


Link to post
Share on other sites

Maybe i'm jaded, but whenever i encounter the words intel and integrated, I move on, and never look back


I have to agree with you, the intel graphics have been a real thorn in my side. Unfortunately i'm stuck with them. I tried changing the GL_PACK/UNPACK_ALIGNMENT? and different formats (e.g. GL_RGBA8), but still no luck.

Share this post


Link to post
Share on other sites
You use Unpack whenever you are sending information to the Card. You use Pack whenever you want to read something from the card. One of the way you can speed it up is to have two FBOs. That way wile you are saving one FBO you can start writing to the one at the same time.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!