OpenGL saving textures
Sorry to ask another newbie question, but I can''t find info on this anywhere.
I''m still kind of used to DX''s SaveTextureToFile function. Is there any functionality in OpenGL that resembles this? I created a texture with noise and now I want to save it to a jpeg, or maybe bmp. I can imagine coding the saving to a bmp myself, but I was wondering if OpenGL has anything at all that will help me with this. Thanks!
start with this
glCopyTexImage2D( GL_TEXTURE_2D, 0, GL_RGB, 0, 0, m_iTexSize, m_iTexSize, 0 );
and
glGetTexImage( GL_TEXTURE_2D, 0, GL_RGB, GL_UNSIGNED_BYTE, m_pTexBuffer );
it takes whatever texture is currently bound, and dumps the texture data (rgb for each pixel) into an array m_pTexBuffer in my case.
then you can look up different file formats and save this info any way you need.
[edited by - Mulligan on January 25, 2004 3:55:05 PM]
glCopyTexImage2D( GL_TEXTURE_2D, 0, GL_RGB, 0, 0, m_iTexSize, m_iTexSize, 0 );
and
glGetTexImage( GL_TEXTURE_2D, 0, GL_RGB, GL_UNSIGNED_BYTE, m_pTexBuffer );
it takes whatever texture is currently bound, and dumps the texture data (rgb for each pixel) into an array m_pTexBuffer in my case.
then you can look up different file formats and save this info any way you need.
[edited by - Mulligan on January 25, 2004 3:55:05 PM]
Well I already have the image data in an array because that''s what I fill first, and then I bind that data. So I guess I''ll just look up the image formats and how to save them.. thanks a lot though, it''s still good to know those functions
quote:Original post by okonomiyaki
Well I already have the image data in an array because that''s what I fill first, and then I bind that data. So I guess I''ll just look up the image formats and how to save them.. thanks a lot though, it''s still good to know those functions
Or take a look at free image libraries like <A HREF="http://openil.sourceforge.net/">DevIL</A>.
quote:Original post by Anonymous Poster
Or take a look at free image libraries like <A HREF="http://openil.sourceforge.net/">DevIL</A>.
Wow, that''s exactly what I was looking for. Thanks a lot!
Or, another Open Source solution:
Corona
It''s always nice to have options in case one API is more appealing than another.
Corona
It''s always nice to have options in case one API is more appealing than another.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement