Copy Part Of OpenGL Texture to Another OpenGL

Hi Jesse,
I’m not sure the exact feature exists in OpenGL for copying from a
texture to a texture, but it’s possible someone has added such an
extension by now. I’ve done a similar thing a few times where I copy
from the framebuffer to a texture like this:

glReadBuffer(GL_BACK);
glCopyTexSubImage2D(GL_TEXTURE_2D, …);

For some other ideas you can see this thread:
http://www.opengl.org/discussion_boards/ubbthreads.php?ubb=showflat&Number=247142--
Terry Welsh
mogumbo ‘at’ gmail.com
www.reallyslick.com

Message: 4
Date: Sun, 13 Jun 2010 08:17:15 -0400
From: Jesse Palser
To: sdl at lists.libsdl.org
Subject: [SDL] Copy Part Of OpenGL Texture to Another OpenGL Texture?
Message-ID: <1276431435.1897.80.camel at JeZ-l-Lee-Desktop>
Content-Type: text/plain; charset=“UTF-8”

Hi,

I am using SDL 1.2 with OpenGL.

How would I copy part of one OpenGL texture
to another OpenGL texture?

Interested in using dirty rectangle system of drawing
to improve drawing performance
on old systems using OpenGL software rendering.

Thanks!

Jesse

You could use glGetTexImage() and do the copying you want yourself. Then
upload that image again to the texture object you wanted to copy to
using glTexSubImage ()…

Not sure that is what you are looking for.On 6/13/2010 11:03 PM, Terry Welsh wrote:

Hi Jesse,
I’m not sure the exact feature exists in OpenGL for copying from a
texture to a texture, but it’s possible someone has added such an
extension by now. I’ve done a similar thing a few times where I copy
from the framebuffer to a texture like this:

glReadBuffer(GL_BACK);
glCopyTexSubImage2D(GL_TEXTURE_2D, …);

For some other ideas you can see this thread:
http://www.opengl.org/discussion_boards/ubbthreads.php?ubb=showflat&Number=247142

Terry Welsh
mogumbo ‘at’ gmail.com
www.reallyslick.com

Message: 4
Date: Sun, 13 Jun 2010 08:17:15 -0400
From: Jesse Palser
To: sdl at lists.libsdl.org
Subject: [SDL] Copy Part Of OpenGL Texture to Another OpenGL Texture?
Message-ID:<1276431435.1897.80.camel at JeZ-l-Lee-Desktop>
Content-Type: text/plain; charset=“UTF-8”

Hi,

I am using SDL 1.2 with OpenGL.

How would I copy part of one OpenGL texture
to another OpenGL texture?

Interested in using dirty rectangle system of drawing
to improve drawing performance
on old systems using OpenGL software rendering.

Thanks!

Jesse


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

I think an efficient way to to it if both textures are on GPU memory,
that requires a bit more code though, would be to use the destination
texture as a render target (see OpenGL render target extension) and then
just draw the part you want from the source texture to the part you want
on the destination texture. The copy will be done without the roundtrip
from host memory to GPU memory.

However, the original post mentionned software OpenGL implementation, so
that might not be worth the hassle, and the rendering (texture filling
and all) might be slower (on software implementations) than the readback
using glGetTexImage() followed by the upload using glTexSubImage2D()…

Martin

Terry Welsh wrote:> Hi Jesse,

I’m not sure the exact feature exists in OpenGL for copying from a
texture to a texture, but it’s possible someone has added such an
extension by now. I’ve done a similar thing a few times where I copy
from the framebuffer to a texture like this:

glReadBuffer(GL_BACK);
glCopyTexSubImage2D(GL_TEXTURE_2D, …);

For some other ideas you can see this thread:
http://www.opengl.org/discussion_boards/ubbthreads.php?ubb=showflat&Number=247142

Terry Welsh
mogumbo ‘at’ gmail.com
www.reallyslick.com

Message: 4
Date: Sun, 13 Jun 2010 08:17:15 -0400
From: Jesse Palser
To: sdl at lists.libsdl.org
Subject: [SDL] Copy Part Of OpenGL Texture to Another OpenGL Texture?
Message-ID: <1276431435.1897.80.camel at JeZ-l-Lee-Desktop>
Content-Type: text/plain; charset=“UTF-8”

Hi,

I am using SDL 1.2 with OpenGL.

How would I copy part of one OpenGL texture
to another OpenGL texture?

Interested in using dirty rectangle system of drawing
to improve drawing performance
on old systems using OpenGL software rendering.

Thanks!

Jesse


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org