Sign in to follow this  
666_1337

copiing framebuffer into texture

Recommended Posts

Hi I need to copy to Framebuffer into a texture. After searching through the internet for a while, I found that I could copy the current readbuffer into a texture with the glCopyTexImage2D command ( I can't use wgl_RenderToTexture since I am using linux / SDL ). I managed to get the thing working and was able to copy the current screen into a texture so it could be rendered. But, however, if I don't IMMIDIATELY use the rendered Texture, an bind other textures instead, the rendered texture gets deleted from the graphics memory - and I cann't reload it since i don't have the image on the main memory. Since I need to bind other textures between the framebuffer-read and the use of it's texture, I need to be able to `store` the texture-data somehow. But Reading from the Graphics Card is extremely slow... can I copy the texture onto a server-side memory region that does NOT get overwritten if the textures bindage changes?

Share this post


Link to post
Share on other sites
By no means should OpenGL delete your texture if you dont use it immediately. You must have done something wrong some where.

Share this post


Link to post
Share on other sites
It might simply be that you've forgotten to bind the correct texture before doing glCopyTexImage2D, so the texture data gets copied into the wrong texture object. :)

Share this post


Link to post
Share on other sites
Did you do a "glGenTextures(1, (GLuint*)&thisTexNum);" to generate a new texture number first, or are you reusing an already allocated texture number? If you're re-using an already allocated texture, use glCopyTexSubImage (EDIT: I originally said "glUpdateTexture" - my bad)...

[Edited by - DJHoy on August 17, 2004 3:18:18 PM]

Share this post


Link to post
Share on other sites
Quote:
Original post by DJHoy
If you're re-using an already allocated texture, use glUpdateTexture...

What's glUpdateTexture? I don't know about it, neither do my man pages or Google.

Share this post


Link to post
Share on other sites
Quote:
Original post by TomasH
Quote:
Original post by DJHoy
If you're re-using an already allocated texture, use glUpdateTexture...

What's glUpdateTexture? I don't know about it, neither do my man pages or Google.


My bad - I wrote that off the top of my head and was thinking of something else... I meant glCopyTexSubImage to replace part (or all) of a texture image with your new image.

Share this post


Link to post
Share on other sites
Oh, then I understand [grin]. Yes, glCopyTexSubImage2D is better if you've already created a texture. Remember that the original texture has to be at least as big as the new one.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this