Archived

This topic is now archived and is closed to further replies.

valg3

Need Faster glReadPixels()

Recommended Posts

I''ve recently begun working on an occluder using the HOM method, and in order to do that you need to get a copy of the frame buffer every frame. I''m using glReadPixels() and just discovered how slow it is... by more than I''m willing to tolerate! Does anyone have faster methods of accessing the frame buffer? I only call glReadPixels() once per frame, and the fps drops from above 60 to 20. All suggestions are appreciated.

Share this post


Link to post
Share on other sites
most occulders i know of are done using a fast and simple software renderer to generate the HOM because of the poor readback speed of the framebuffer

Apprently the NV40 will have an improved frame buffer readback on it, but for every other card currently around there just isnt a quick way to do it.

Share this post


Link to post
Share on other sites
The best will come from PCI-Express, which is apparently -much- better suited to downloads from video-memory (in addition to having more raw bandwidth).

Share this post


Link to post
Share on other sites
the problem isnt so much todo with teh downstream rate but todo with readback lantancy and the fact that you have to stall the pipeline in order to readback teh frame buffer, so while you will see an increase with PCI-express as to if that increase is more or less than writing a simple software rasteriser to do the HOM i dont know

Share this post


Link to post
Share on other sites
Alright, thanks for the info. I'm still going to keep looking though because I'm not doing a software rasterizer :-
Though, the idea of doing a quick one seems interesting. I'll give it a try.

[edited by - valg3 on April 21, 2004 2:20:44 AM]

Share this post


Link to post
Share on other sites
well, you dont have to do a full rasterizer, it just needs to be able to write shells (well, bounding boxes is what i ment) iirc

there are a couple of discussions about it in the Graphics Programming and Theory board (although i dont have any direct links right now)

edit: correction of words caused by post sleep brain malfunctions

[edited by - _the_phantom_ on April 21, 2004 11:06:43 AM]

Share this post


Link to post
Share on other sites
valg3,

Sounds like you could use a p-buffer in this situation, not sure if its any faster/slower than glReadPixels, but i''m sure you can give it a try.

-brad

Share this post


Link to post
Share on other sites
Thanks again. I don''t plan on writing a full rasterizer for it, definitely just the shells bit. Single color triangles is all I''ll need. I''m afraid I have no experience with p-buffers. I''m guessing that only particular OpenGL libraries have them for offscreen rendering?

Share this post


Link to post
Share on other sites
p-buffers are indeed just off screen rendering, however if you need to run some sort of analsys on the data i dont think that will help a huge amount simply due to the read back issues (i could be wrong however.

the "render targets" extension which was proposed by some guys at Nvidia might help out a bit with this kind of problem (but we probably wont see that for a while as yet), but at the end of the day the currently existing gfx cards just arent really designed to be read back from at decent speeds it seems

Share this post


Link to post
Share on other sites