Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

okonomiyaki

OpenGL OpenGL saving textures

This topic is 5316 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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!

Share this post


Link to post
Share on other sites
Advertisement
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]

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
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>.

Share this post


Link to post
Share on other sites
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!

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!