Jump to content
  • Advertisement
Sign in to follow this  
Ewr

OpenGL Memory Maped texture

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

I have a void* pointer to a memory maped texture, how can i use an area of that file as a texture in OpenGL? Can it be done with DevIL?

Share this post


Link to post
Share on other sites
Advertisement
you've a pointer to the memory so just pass it to the opengl function to upload the texture data (assuming its a normal uncompressed bmp or DDS image, if its not you'll have to load it and convert it to a format OGL understands... as to if DevIL can do it, I've no idea).

Share this post


Link to post
Share on other sites
It's a memory maped png-file, and I can't load all data, it's to big, I just want a smaller area of it loaded as a texture...

Share this post


Link to post
Share on other sites
You can try to use the low level read interface of libpng to decode part of the image, and upload that as a texture to OpenGL. But keep in mind that due to the way PNG compresses images (interlacing and row based compression), you cannot simply decode an arbitrary sub-rectangle. You must always process 8 entire rows at a time in order to get meaningful data.

Share this post


Link to post
Share on other sites
If I use a bmp instead? Can it be done easier then? Theres no need to use png...

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.

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!