copiing framebuffer into texture

Started by
7 comments, last by 666_1337 19 years, 8 months ago
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?
our new version has many new and good features. sadly, the good ones are not new and the new ones are not good
Advertisement
By no means should OpenGL delete your texture if you dont use it immediately. You must have done something wrong some where.
"I seek knowledge and to help those who also seek it"
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
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. :)
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]
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.
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.

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.
sorry. my fault. I forgot to disable mipmapping before i registred the texture.
our new version has many new and good features. sadly, the good ones are not new and the new ones are not good

This topic is closed to new replies.

Advertisement