Jump to content
  • Advertisement
Sign in to follow this  
ProblemBaby

Read Texture Data

This topic is 4734 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

Ive created a texture from an image and released the data buffer. Is it somehow possible to get the data back from the texture or do Ive to load the image again? Thanks

Share this post


Link to post
Share on other sites
Advertisement
Hi,
when you load your texture in the first time make a copy from your texture array .
i hope this is what you want .
bye

Share this post


Link to post
Share on other sites
Do you mean that I shall save the imagedata?

example:

--------------------
BYTE *byData;
byData = new BYTE[imWidth * imHeight];
LoadImageToBuffer(byData);

glCreateTex(.. . .. byData)

delete [] byData;
-------------------

now it would be nice if I could read directly from the texture memory, instead of having a copy all the time.

Share this post


Link to post
Share on other sites
Hello,
there are two methods :
1)make a global pointer (outside your loading function) then copy the data into it
2)draw a quad (with any resolution you want) apply the textur on it use glReadPixel() after that clear the buffer.
bye

Share this post


Link to post
Share on other sites
Quote:
Original post by ProblemBaby
Ive created a texture from an image and released the data buffer.
Is it somehow possible to get the data back from the texture or do Ive to load the image again?

Thanks
Check out glGetTexImage. But beware that it is slow (so is rendering it to the framebuffer and using glReadPixels) so if you want it to run fast just don't bother releasing the data and keep it in memory.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

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

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!