rendering GL view to a bitmap to create a thumbnail

Hi, I know that this question appears to have been asked (and answered many times before). I can render gl views to a bitmap quite sucessfully, all that I’m after is a bit of confirmation in my reasoning…

Ok, I have 2D and 3D views in a MFC MDI application. I create thumbnails of the individual views and whack the thumbs in a list control as a kind of summary view. At the same time I’m getting live data from our instruments and herein lies my trouble…

The intensive rendering is conteding with the data processing. Up until now I have been rendering the thumbs as full scale views the using StretchDIBits to resize the bitmap.

My question is, what would the effect be of resizing the viewport to render the thumbnail directly, then setting the viewport back to it’s original size? My feeling is that I’d get less overall CPU overhead and the thumb quality might even be improved…

Sorry to be so vague. Anyone have any thoughts?


Seems to me that you need to either render to a pbuffer (obviously the pbuffer and viewport sizes will be the same as your thumbnail) or take a `snapshot’ of your scenes. It depends on how often you need to update your list box. If it needs to be done often, then you might consider deriving a new control from the list box and overriding its render method to provide you with a GL context instead of the ordinary blitter (which is a pain in the buttie).

You could resize your viewport for this one render and your speed-up will be noticable depending on what kind of fill-rate your card has. At the end of the day, the problem here is you will still have to perform a read-back of the buffer, which will be very slow (but you will be reading back less pixels).

Personally, I think the small pbuffer is the way to go. They are designed for off screen rendering, which is what you want I think.

Your stretchbits command is about as slow as you can go (totally software) - and you are shifting gigantic amounts of data around the system to do this.

[This message has been edited by Robbo (edited 05-21-2002).]