Jump to content

  • Log In with Google      Sign In   
  • Create Account


glReadPixels() Performance Issue


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
4 replies to this topic

#1 ziashan   Members   -  Reputation: 108

Like
0Likes
Like

Posted 07 December 2012 - 08:57 AM

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.

Sponsor:

#2 Kaptein   Prime Members   -  Reputation: 1843

Like
0Likes
Like

Posted 07 December 2012 - 01:03 PM

"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, 07 December 2012 - 01:14 PM.


#3 Scourage   Members   -  Reputation: 683

Like
0Likes
Like

Posted 07 December 2012 - 03:11 PM

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

Halfway down the trail to Hell...

#4 ziashan   Members   -  Reputation: 108

Like
0Likes
Like

Posted 10 December 2012 - 03:37 PM

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.

#5 BornToCode   Members   -  Reputation: 892

Like
0Likes
Like

Posted 25 December 2012 - 03:28 PM

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.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS