What is The Best Method For Use Large Image?

Hi all,
I need to use a large image for my texture my image size is 8000*8000 pixel and in bmp format.
when I run program at start it need too many ram and also in run time?
I see some topic in net about dds file format. Do you know about this format? Is that comppresed and need less memory than bmp file?
Or do you have another suggestion for solving my problem?

For something of that size, you can consider using a tool like squish to compress your image, then save it to disk. There are other libraries that might be faster or produce higher quality compression but squish is very good and easy to use. Do this once as a preprocess step, then your application can load the compressed image (which will be faster than loading a bitmap since it is smaller), and send it to OpenGL with a command like glCompressedTexImage2D. Note that the image stays compressed on the video card, and is decompressed on the fly, which is very fast. Also, since the texture is now in video memory (hopefully, I guess I should say it is in driver controlled memory), you can delete or free() any memory you used to allocate your image. Even better, you can get rid your system memory allocation if you use glMapBuffer and a PBO. Google for more info.

If you need to support truly massive images that do not fit into system memory, google for “virtual texturing.”


Hi pjcozzi,
Can You Tell me more about how to compess image, I only know that dds format is one of them.

and another problem when i convet my 8000*8000 pixel bmp to dds type1 and want to view it with dds viewer, it say that your graphic texture size is 4096 and couldn’t load and open it.

And third can you give me an example code of loading compressed image in opengl?

DDS is an image file format, not a compressor. IIRC it supports storage of images in some GPU compressed internal formats, but don’t much care since that’s a Windoze thing and doesn’t support everything we need.

For a good, free DXT compressor, check out Simon Brown’s squish.

And third can you give me an example code of loading compressed image in opengl?

glCompressedTexImage2D( GL_TEXTURE_2D, mip_level, iformat, w, h, 0, mip_size, texels );

If MIPmapping, repeat for each level. iformat is a GL compressed internal format, such as GL_COMPRESSED_RGBA_S3TC_DXT5_EXT.