I need to load PNGs and JPGs to text开发者_运维问答ures. I also need to save textures to PNGs. When an image exceeds GL_MAX_TEXTURE_SIZE I need to split the image into separate textures.
I want to do this with C++.
What could I do?
Thank you.
I need to load PNGs and JPGs to textures
- SDL_Image
- Qt 4
- or use libpng and libjpeg directly (you don't really want to do that, though).
When an image exceeds GL_MAX_TEXTURE_SIZE I need to split the image into separate textures.
You'll have to code it yourself. It isn't difficult.
DevIL can load and save many image formats including PNG and JPEG. It comes with helper functions that upload these images to OpenGL textures (ilutGLBindTexImage
, ilutGLLoadImage
) and functions to copy only parts of an image to a new image (ilCopyPixels
, can be used to split large textures).
For the loading part SOIL looks rather self-contained.
精彩评论