Loading Images with TR - OpenGL Tile Rendering library?


Does anyone here know how to get large image rendering using TR library?

Thanks & Regards

To be more specific, how can I load an image with resolution more than 2kx2k.?? Currently I display the image as texture by rendering them as quads. The reading of the image file works fine. But the glTexImage2D function is having limitation on the size of an image file. So I get a white rectangle displayed on my screen. So other than TR library, is there any other alternative to load high resolution image using opengl?


glTexImage2D function is having limitation

The function does not have limitations, the graphics hardware has limits. You cannot create a image buffer greater than the hardware limit. This can be 2kx2k or 8kx8k on different hardware. So if you wish to render an image bigger than the hardware limit you have to tile it.

I couldn’t put it in proper words. And that’s the reason why I switched over to TR library. I’m failing to break the large image into tiles. Then second thing is how to render the tiled image? A suitable example consisting of reading the image and break them to tiles is what i’m looking for.

The TR library isn’t about using large textures, it’s about creating an image which is larger than the largest supported framebuffer by rendering the scene multiple times, with the projection matrix adjusted to render a single “tile” of the final image in each step.

If you need to use textures which are larger than the maximum supported texture size, first you need to break up your image data into multiple textures (or multiple levels of an array texture). You can use glPixelStore() with GL_UNPACK_ROW_LENGTH to avoid having to copy the image data to smaller, packed arrays.

Then, you either need to break up your polygons along tile boundaries, or use a fragment shader which maps texture coordinates to a specific tile and coordinates within that tile.

Hi GClements,

Thanks for your reply. Any reference or link or a small example with regards to your explanation, if available, will be helpful for me.



How can I break up image data into multiple textures as explained by GCelements above?



I tried the solution given by GClements. First I got the max texture size (say max_tsize) supported by the machine. Then I divide the image width and height by the max_tsize. By doing so I get the m*n subimages of max size ‘max_tsize’. Then using the earlier way of rendering, I perform the rendering of each sub-image.

But then, there’s again a limit of max size of texture stack, which is 10 on my machine. And probably due to this stack size limit, some images are not rendered properly. (i.e. when the number of subimages go more than the stack size.

Any alternative for this? Also the rendering speed is very bool, though the rendering I do is with the help of display list. Any suggestions are welcome.

Rakesh Patil

No one…? No comments…? No suggestions…?