SFML community forums
General => Feature requests => Topic started by: Groogy on October 09, 2012, 10:41:45 pm
-
As far as I could see not much were written in the forum about this and the assignment/copy constructor seems to turn the texture to an image before creating a new texture. I am just wondering if there is a reason why you are not using directly the copy functions for textures provided by OpenGL? As far as I can see they exist in very old versions of OpenGL as well so it should be compatible.
While we are at it can't you create a update function like you have for images but for textures instead? Where you can copy a rect from one texture to another without going trough render textures? Would make things more simple.
Do you need a usecase? I want to generate some textures at runtime and currently I have to go trough sprites and render textures to get that. Works so far but later I can't move that data to a texture efficiently without having to make it into an image first which I will need.
-
Which OpenGL functions do you refer to? As far as I know, there's no function to copy a texture to another texture.
-
http://www.opengl.org/sdk/docs/man/xhtml/glCopyTexImage2D.xml
glCopyTexImage2D copies the texels from the buffer bound at the GL_READ_BUFFER buffer right? So if you bind the source texture buffer to that slot it should be possible to copy the textures over right?
I only did a quick google on it when I was trying to solve my problem so I might be wrong. Found some forums that said "It is impossible and you need a fullscreen quad" etc. etc. But reading the documentation I don't see any reason why it would be impossible?
Though what you want is probably the Sub version so you can copy only parts of the texture.
-
GL_READ_BUFFER refers to the color and auxiliary buffers, not textures.
-
Yeah I noticed but there are auxiliary buffers you could use I guess. But those doesn't seem to be fully supported on mobile hardware.(Really old graphics card have 4 buffers but mobile cards seems to have none)
So if I want to do a copy from a rendertexture to another texture for safe keeping I guess I'll have to either render it or do a copy trough system-memory pixels :(
-
Yep, sorry. If there was a more direct solution, I'd use it.