Jump to content
  • Advertisement
Sign in to follow this  
666_1337

copiing framebuffer into texture

This topic is 5150 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Advertisement
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
yeah, i agree with the poster above, then you copy to a texture the data is physicaly moved to a new location, so unless you tell opengl to delete it then it shouldnt go walk abouts at all

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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!