-1

Possible Duplicate:
How can I load 8 bit bmp with OpenGL?

I need to load lots of images as many as possible, and then play them as animation. Therefore I want to minimize the size of each image.

My question is if I load a jpeg image file, will my machine store it as in bmp format? Currently, I am using OpenGL to load bmp images (around 3.5 MB each). 600 bmp files are already exceeding my memory. How can I load more, say 2 thousand.

Community
  • 1
  • 1

2 Answers2

0

You can look into storing your images in a more animation-friendly format. Video comes to mind.

If you need images only once - discard them from memory right after displaying.

Use DXT packed images. With a slight degrade in quality you get an x4/x8 compression ratio.

Check you OpenGL settings, do you use automatically generated mipmaps, do you need them?

Kromster
  • 7,181
  • 7
  • 63
  • 111
  • Thanks Krom, I use 3D_Max to pre-generated bitmaps, then try to use OpenGL to play these images as animation in a loop in a frame rate of 60 fps. So I can't discard them. During playing, I need to change the speed of the animation by skipping one or more images in every step. I don't if I am clear. But I do hope you can help me out of this problem. Thank you very much. – Chen Daniel Jinzhao Aug 19 '12 at 14:24
0

My question is if I load a jpeg image file, will my machine store it as in bmp format?

You machine will keep it in memory as raw pixels, except if you're using a compressed texture format, which is however very different from JPEG.

File formats are meaningless for the hardware and OpenGL.

How can I load more, say 2 thousand.

You shouldn't. If you're playing an animation, load the image when it's due to show, then delete it afterwards. In the case of OpenGL you should use glTexSubImage2D to replace the contents of a texture object.

datenwolf
  • 159,371
  • 13
  • 185
  • 298
  • Thank you, datenwolf. Actually, I have a slideshow-like program to play the animation, just like what you said "load the image when it's due to show, then delete it afterwards", but the frame rate is low. I want 60 fps. Any idea? – Chen Daniel Jinzhao Aug 19 '12 at 14:33
  • @ChenDanielJinzhao: 60fps should be easily achievable on modern hardware. First you should make use of Pixel Buffer Objects, so that you can asynchronoulsly load image data to OpenGL memory. If you have OpenGL-4 available use a combination of glTexStorage and glTexSubImage2D to reduce the overhead in creating the actual texture object. – datenwolf Aug 19 '12 at 14:42