Skip to main content
gamedev.net
🔒 Locked

Memory Maped texture

Started by Ewr 3 replies 950+ views
Original Post
Ewr
Ewr
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?
_the_phantom_
_the_phantom_
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).
Ewr
Ewr
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...
Yann L
Yann L
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.
Ewr
Ewr
If I use a bmp instead? Can it be done easier then? Theres no need to use png...

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.