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

  • Home
  • SEARCH
  • 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 6722853
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T09:29:51+00:00 2026-05-26T09:29:51+00:00

Since nothing but the size of the window evolve, is it normal my program

  • 0

Since nothing but the size of the window evolve, is it normal my program needs one full core to render the scene on a maximized window ?

I’m using Qt 4.7 in the C++ language on windows to draw 150 pictures (components are RGBA, each on a byte) of those dimensions : 1754*1240.
I load my textures like this :

glGenFramebuffers(TDC_NB_IMAGE, _fborefs);
glBindFramebuffer(GL_FRAMEBUFFER, _fbo);
//initialize tex
glGenTextures(TDC_NB_IMAGE, _picrefs);
for (int i = 0 ; i < TDC_NB_IMAGE ; i++)
{
    qDebug() << "loading texture num : " << i;
    _pics[i].scale = 1.f;
    _pics[i].pos.rx() = i % ((int)sqrt((float)TDC_NB_IMAGE));
    _pics[i].pos.ry() = i / ((int)sqrt((float)TDC_NB_IMAGE));
    _pics[i].text.load("imgTest.png");
    glBindTexture(GL_TEXTURE_2D, _picrefs[i]);
    glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP );
    glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP );
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);//GL_LINEAR_MIPMAP_LINEAR
    glTexImage2D (GL_TEXTURE_2D, 0, GL_COMPRESSED_RGBA_S3TC_DXT5_EXT,
        TDC_IMG_WIDTH, TDC_IMG_HEIGHT, 0, GL_BGRA_EXT, GL_UNSIGNED_BYTE,
        _pics[i].text.toImage().bits()
        );
    //glGenerateMipmap(GL_TEXTURE_2D);
    glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, _picrefs[i], 0);
}
glBindFramebuffer(GL_FRAMEBUFFER, 0);

I draw my scene like this :

glBindFramebuffer(GL_FRAMEBUFFER, _fbo);
glClear( GL_COLOR_BUFFER_BIT);
//for each image
for (int i = 0 ; i < TDC_NB_IMAGE ; i++)
{
    //compute coords
    if (_update)
    {
        //pos on 0,0
        _pics[i].quad.topleft.rx() = 0;
        _pics[i].quad.topleft.ry() = 0;
        _pics[i].quad.topright.rx() = TDC_IMG_WIDTH;
        _pics[i].quad.topright.ry() = 0;
        _pics[i].quad.botright.rx() = TDC_IMG_WIDTH;
        _pics[i].quad.botright.ry() = TDC_IMG_HEIGHT;
        _pics[i].quad.botleft.rx() = 0;
        _pics[i].quad.botleft.ry() = TDC_IMG_HEIGHT;
        //translate
        QPointF dec(0, 0);
        dec.rx() = _pics[i].pos.x() * TDC_IMG_WIDTH + _pics[i].pos.x() * TDC_SPACE_IMG;
        dec.ry() = _pics[i].pos.y() * TDC_IMG_HEIGHT + _pics[i].pos.y() * TDC_SPACE_IMG;
        _pics[i].quad.topleft += dec;
        _pics[i].quad.topright += dec;
        _pics[i].quad.botright += dec;
        _pics[i].quad.botleft += dec;
        //scale
        _pics[i].quad.topleft *= _globalScale;
        _pics[i].quad.topright *= _globalScale;
        _pics[i].quad.botright *= _globalScale;
        _pics[i].quad.botleft *= _globalScale;
        _update = false;
    }
    //prepare tex drawing
    //draw drawing area
    glBindTexture (GL_TEXTURE_2D, 0);
    glBegin (GL_QUADS);
    glTexCoord2f (0.0, 0.0);glVertex3f (_pics[i].quad.topleft.x(), _pics[i].quad.topleft.y(), 0);
    glTexCoord2f (1.0, 0.0);glVertex3f (_pics[i].quad.topright.x(), _pics[i].quad.topright.y(), 0);
    glTexCoord2f (1.0, 1.0);glVertex3f (_pics[i].quad.botright.x(), _pics[i].quad.botright.y(), 0);
    glTexCoord2f (0.0, 1.0);glVertex3f (_pics[i].quad.botleft.x(), _pics[i].quad.botleft.y(), 0);
    glEnd();
    //draw texture
    glBindTexture (GL_TEXTURE_2D, _picrefs[i]);
    glBegin (GL_QUADS);
    glTexCoord2f (0.0, 0.0);glVertex3f (_pics[i].quad.topleft.x(), _pics[i].quad.topleft.y(), 0);
    glTexCoord2f (1.0, 0.0);glVertex3f (_pics[i].quad.topright.x(), _pics[i].quad.topright.y(), 0);
    glTexCoord2f (1.0, 1.0);glVertex3f (_pics[i].quad.botright.x(), _pics[i].quad.botright.y(), 0);
    glTexCoord2f (0.0, 1.0);glVertex3f (_pics[i].quad.botleft.x(), _pics[i].quad.botleft.y(), 0);
    glEnd();
}
glBindFramebuffer(GL_FRAMEBUFFER, 0);

After some benchmarking, it seems the heavy CPU usage comes from the “//draw texture” block. Actually, sometimes it takes 0ms and sometimes 400ms. Overall, the paintGL function takes 5seconds to render the scene when the window is maximized, and close to 0 when the window is at 800*600 size.
I change the scale during the rendering (only modifying _globalScale) so i can see the 150 pictures whatever the size of the window. The scale of the pictures doesn’t change anything to the CPU usage.

I started using OpenGL 2 weeks ago, so i surely missed something in the documentation and tutorials.. but even if i read them again, i don’t find neither the explanation nor another way to render those 150 pictures.
In the future it will be possible to modify a picture (more precisely a layer of this picture, which implies more textures) with a graphic tablet or even the mouse, so i need the speed improvement.

  • 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-05-26T09:29:52+00:00Added an answer on May 26, 2026 at 9:29 am

    Load scaled down versions of your images for fast rendering and low memory pressure. Then when you’re zoomed in on a particular subset of images you can load the full-resolution ones and display those instead of the low-resolution textures.

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

Sidebar

Related Questions

I'm working on a program with OpenGL/SDL, but the window won't draw. The window's
I have a big problem with my server mysql. All worked fine but since
Since I started studying object-oriented programming, I frequently read articles/blogs saying functions are better,
Since CS3 doesn't have a web service component, as previous versions had, is there
Since both a Table Scan and a Clustered Index Scan essentially scan all records
Since Graduating from a very small school in 2006 with a badly shaped &
Since the WMI class Win32_OperatingSystem only includes OSArchitecture in Windows Vista, I quickly wrote
Since debate without meaningful terms is meaningless , I figured I would point at
Since the keyboard is the interface we use to the computer, I've always thought
Since Rails is not multithreaded (yet), it seems like a threaded web framework would

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.