OpenGL Texture to SDL Surface

Hi,

So, I’m really quite good at OpenGL, but I’m learning how to use it in
conjunction with SDL and in C++, both of which I’m new to.

I have a simple 2D texture (in GL_UNSIGNED_BYTE format). I would now like
to change it into a surface. I think glGetTexImage(…); would do the job
of getting the data. How do I integrate that into a texture-to-surface
transfer?

Thanks,
Ian

if you can grab the pixel data from it, just call SDL_CreateRGBSurfaceFrom(). Look at the docs for more.------------------------
EM3 Nathaniel Fries, U.S. Navy

http://natefries.net/

Ian Mallett wrote:

Hi,

So, I’m really quite good at OpenGL, but I’m learning how to use it in conjunction with SDL and in C++, both of which I’m new to.?

I have a simple 2D texture (in GL_UNSIGNED_BYTE format).? I would now like to change it into a surface.? I think glGetTexImage(…); would do the job of getting the data.? How do I integrate that into a texture-to-surface transfer?

Thanks,
Ian

#avg_ls_inline_popup { position:absolute; z-index:9999; padding: 0px 0px; margin-left: 0px; margin-top: 0px; width: 240px; overflow: hidden; word-wrap: break-word; color: black; font-size: 10px; text-align: left; line-height: 13px;}

If you’ve uploaded texture data to OpenGL, doesn’t that imply that you had the texture data available at some point? And if so, can’t you just build the SDL surface directly from that data?

if you can grab the pixel data from it, just call
SDL_CreateRGBSurfaceFrom(). Look at the docs for more.

Will try that.On Wed, Aug 25, 2010 at 6:13 PM, Nathaniel J Fries wrote:

On Thu, Aug 26, 2010 at 12:23 AM, Jesse A. wrote:

If you’ve uploaded texture data to OpenGL, doesn’t that imply that you had
the texture data available at some point? And if so, can’t you just build
the SDL surface directly from that data?

It’s from some render to texture operations, so no.

Ian