How to create textures from large images in opengl (bigger than the MAX_TEXTURE_SIZE)

4.4k Views Asked by At

I've found that the maximum texture size that my opengl can support is 8192 but the image that I'm working with is 16997x15931. As you can see in this link, I've completed the class COpenGLControl and customized it for my own use to work with a smaller 7697x7309 image and activated different navigation tasks for it.

Render an outlined red rectangle on top a 2D texture in OpenGL

but now in the last stages of work, I've decided to change the part where applies the texture and enable it to handle images bigger than the size 8192.

Questions:

  • Is it possible in my opengl?
  • what concept should I study mipmaps, multiple texturing?
  • Will it expand performance of code?

Right now my program uses 271 MB of ram for just showing this small image(7697x7309) and I'm going to add a task to it (for image-processing filtering processes) that I have used all my effort to optimize the code but it uses 376 MB of ram for the (7697x7309) image(the code is already written as a console application will be combined with this project). So I think the final project would use up to 700 MB of ram for images near the 7000x7000 size. Obviously for the bigger image (16997x15931 ) the usage of ram will be alot higher!

So I'm looking for a concept to handle images bigger than the MAX_TEXTURE_SIZE and also optimize the performance of the program

More Questions:

  • What concept should I study in OpenGL to achieve the above goal?
  • explain alittle about the concept that you suggest?

I've asked the question in Game Developement too but decided to repeat the question here maybe it will have more viewers. As soon as I get the answer, I will delete the question from either on of the sites. So don't worry about multiple questionings.

1

There are 1 best solutions below

7
On BEST ANSWER

I will try to sum up my comments for the original question.

  • know your proper opengl version: maybe you can load some modern extension and work with even the recent version of opengl.
  • to reduce memory you can use some texture compression:
  • another simple idea: you can split the huge texture and create 4 smaller textures (from 16k x 16k into four 8k x 8k) and somehow render four squares.
  • maybe you can use OpenCL or CUDA to do the work?
  • regarding mipmaps: it is set of smaller version of your input texture, mipmaps improve performance and final quality of the filtering, but you need another 33% more memory for a texture with full mipmap chain. In your case they could be very helpful. For instance when you look at a wall from a huge distance you do not have to use full (large) texture... only a small version of it is enough. g-truc on mipmaps

In general there is a lot of options, but it depends on your experience what is simpler and fastest to implement.