开发者

Advice on cross-platform OpenGL image loader for textures

开发者 https://www.devze.com 2023-01-09 14:48 出处:网络
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 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

  1. SDL_Image
  2. Qt 4
  3. 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消