Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8396697
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T20:36:21+00:00 2026-06-09T20:36:21+00:00

Here is my situation: I need to preload 2000 images and display them in

  • 0

Here is my situation: I need to preload 2000 images and display them in sequence to be an animation in 60 fps. Currently, I am using OpenGL to load bmp files, but due to memory limit, I can only preload up to 500+ images. How can I solve this problem? I can so far come up with two directions of solutions: First, maybe I can load 8 bit bmp images to save memory. But I have difficulty in using glDrawPixels. Secondly, if possible can I load jpeg directly? Thanks for any advice!

The reason for not using video is that I need to change to animation speed by skipping one or more images as you can see in the code (imgCount+=stp; // stp means how many images to escape. it can make video faster). And in my animation, frame rate is important, FPS lower than 50 shows flickering.

Here is the code:

void Frame::LoadBMP(void){

 FILE *in;


 in=fopen(file,"rb");//open file 
 if(in==NULL){

     exit(0);
 }
 fread(&(this->bmfh),sizeof(BITMAPFILEHEADER),1,in);//read bmp file header
 fread(&(this->bmih),sizeof(BITMAPINFOHEADER),1,in);//read bmp infomation header

 colours=new RGBQUAD[bmih.biBitCount];
 fread(colours,sizeof(RGBQUAD),bmih.biBitCount,in);//read bmp colour table

 size=bmfh.bfSize-bmfh.bfOffBits;
 tempPixelData=new GLubyte[size];

 if(tempPixelData==NULL) {
     fclose(in);
 }
 fread(tempPixelData,sizeof(GLubyte),size,in);//read bmp image data
 fclose(in);
}

and I will display the sequence of images, the display code:

void display(void){

static clock_t start=clock();
static clock_t end=clock();

CurrtempPixelData=msFrame[offset]->tempPixelData;

glEnable(GL_ALPHA_TEST);
glEnable(GL_BLEND);

glDrawPixels(frWidth, frHeight, GL_RGBA, GL_UNSIGNED_BYTE, msFrame[offset]->tempPixelData);

for(int i=0;i<m;i++){
    clock_t c=clock();
}

glutSwapBuffers();
imgCount+=stp; // stp means how many images to escape. it can make video faster.
offset=imgCount%numFrame;
glutPostRedisplay();

}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T20:36:22+00:00Added an answer on June 9, 2026 at 8:36 pm

    You should not use glDrawPixels, it is deprecated functionality. The best way to do it would probably be drawing a screen-sized quad (-1,-1 => 1,1 without any matrix transform) that you texture with these images.

    For the textures you can specify several internal formats in glTexImage2D and similar functions. For example, you could use the GL_R3_G3_B2​ format to get your 8-bit size, but could as well use the compressed formats like S3TC. You could for example pass COMPRESSED_SRGB_S3TC_DXT1_EXT, which should reduce your image size to 4 bits per pixel, likely at better quality than the 8 bit format. You cannot use JPEG as a compression format in OpenGL (it’s too complex).

    Finally, why do you want to do this through OpenGL? blitting an image to a regular window will likely give you well enough performance. Then you could even store your image sequence as video and just blit the decoded frames. It’s very unlikely you will ever get memory problems in this case.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm in a somehow tough situation here. I need to load data from multiple
I am using a MySQL database, here's my situation: I need a select query
Here is my situation. I need to create a report that shows each open
Here's my situation: I need to select all the messages where user_id = x
Here's the situation: I need to retrieve the face's under point boundaries, but if
My situation here is that I need to send my program to my university's
i have a situation here where i need to pass the date as sysdate
I have a very dramatic situation here. I need the android sdk and I'm
So here is the situation-- a quote from my boss: [...] we need to
Here's the situation, I've got a C++ codebase which is using a recent GCC

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.