Efficient screen capture -> GL Texture

Hi,
I was wondering if SDL had any way to optimise the screen capture,
that is, to read from a display buffer and copy the data somewhere else.
And that this somewhere else could be on the video memory, stored in a
GL texture for example. So you don’t have to download the buffer’s data
from the video card and upload it again to a GL texture… Is there
any way to optimise this? With or without the option to resize the
image during the transfer…

Thanks for any info!
Simon

Xilo Musimene wrote:

Hi,
I was wondering if SDL had any way to optimise the screen capture,
that is, to read from a display buffer and copy the data somewhere else.
And that this somewhere else could be on the video memory, stored in a
GL texture for example. So you don’t have to download the buffer’s data
from the video card and upload it again to a GL texture… Is there
any way to optimise this? With or without the option to resize the
image during the transfer…

Thanks for any info!
Simon

could you create a hardware surface of the correct format and then
simply blit to it from the surface?

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

Hi,
I was wondering if SDL had any way to optimise the screen capture,
that is, to read from a display buffer and copy the data somewhere else.
And that this somewhere else could be on the video memory, stored in a
GL texture for example. So you don’t have to download the buffer’s data
from the video card and upload it again to a GL texture… Is there
any way to optimise this? With or without the option to resize the
image during the transfer…

Apparently, you’re using OpenGL already. If you use the GL, go GL completely
and don’t use SDL for anything but initial setup.
You can use glReadPixels() to read from the framebuffer, and you can use the
CopyTexImage() family of functions to copy (parts of) the framebuffer into
a texture.
Note that there are also GL extensions to render to textures directly.

cu,
Nicolai

Thanks for any info!
Simon
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQE+ded7sxPozBga0lwRAo5vAJ4nYo+fjnVaVwosK+DPxjX4OzcsUQCcCWdA
jSsXchz2BODyjCF+Xwf2Axc=
=5Plo
-----END PGP SIGNATURE-----On Sunday 16 March 2003 02:39, Xilo Musimene wrote:

Apparently, you’re using OpenGL already. If you use the GL, go GL completely
and don’t use SDL for anything but initial setup.
You can use glReadPixels() to read from the framebuffer, and you can use the
CopyTexImage() family of functions to copy (parts of) the framebuffer into
a texture.
Note that there are also GL extensions to render to textures directly.

Yes I already use GL.

And as for glReadPixels(), I think it is used to download the data from
the buffer to be able to use it in the computer’s RAM (instead of the
video memory)

And I was unable to find anything other than glCopyPixels() which only
copies the pixels into the framebuffer and not a texture.

Thanks for you help,
Simon

could you create a hardware surface of the correct format and then
simply blit to it from the surface?

I was thinking about this, but when I experimented it seemed to give
trouble reading from the screen surface, or should i read directly with
openGL?

Thanks,
Xilo

could you create a hardware surface of the correct format and then
simply blit to it from the surface?

I was thinking about this, but when I experimented it seemed to give
trouble reading from the screen surface, or should i read directly with
openGL?

Use glReadPixels()

See ya,
-Sam Lantinga, Software Engineer, Blizzard Entertainment