[Mesa-dev] Question about texture copy with Mesa

Alexis Hétu vergoroth at gmail.com
Sat Feb 19 12:27:20 PST 2011


Thanks. I already have an OpenGL path doing this, but since the original authors of the code I was looking at had disabled this on Mesa, I thought some limitation was preventing me from using the same code path. I'll double check if everything that is used in OpenGL is supported in Mesa.

Thanks again.

Le 2011-02-19 à 13:33, Kenneth Graunke <kenneth at whitecape.org> a écrit :

> On Friday, February 18, 2011 11:08:40 AM Alexis Hétu wrote:
>> Hi all,
>> 
>>  I have a small question : I'd like to feed the already rendered result of
>> my scene (which is "on screen" right now) into a texture sampler for the
>> rendering of another object. I think this could be achieved by doing
>> something like glReadPixels and then re-uploading that as a texture, but
>> this seems very inefficient to me. It there a better way of doing this ? Is
>> there a proper "MESA" way of doing this ?
>> 
>> Thanks
> 
> The typical way to achieve this is to change your program to render the scene 
> into a FBO (framebuffer object) rather than to the screen.  FBOs can be backed 
> by textures, allowing you to easily sample the results.  Or, if you don't need 
> to sample (say, the depth buffer), you can also use a renderbuffer.
> 
> To get the scene on screen again, you can either use glBlitFramebuffer (the 
> screen is framebuffer 0), or just draw a full-screen quad with a simple shader 
> that samples the FBO's color texture.
> 
> Here's a short tutorial on FBOs:
> http://www.gamedev.net/page/resources/_//feature/fprogramming/opengl-frame-
> buffer-object-101-r2331
> 
> Good luck!


More information about the mesa-dev mailing list