Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 2 of 2

Thread: CPU Usage

  1. #1
    Guest

    CPU Usage

    Hi all!!

    I'm working on a MDI app wich one of the windows is an OpenGL interface. Im doing the redraw stuff in the wm_paint but unless I don't make an InvalidateRect(); the scene doesn't refresh.
    The problem is that, by doing InvalidateRect, the cpu usage goes up to almost 99%.

    Is there any other way of doing this without the cpu usage?

    Thanks in advance!

  2. #2
    Senior Member OpenGL Guru Relic's Avatar
    Join Date
    Apr 2000
    Posts
    2,527

    Re: CPU Usage

    Depends on what OpenGL implementation you're running. If the glGetString (GL_VENDOR) and glGetString(GL_RENDERER) returns Microsoft's implementation, everything is drawn with the CPU.
    If you're on a hardware implementation, it still depends on what you're doing and how fast your host is.
    It's normal that continually rendering OpenGL as fast as you can will max out the CPU on fast hardware. That is why it's a bad idea to render in the idle loop for non-game apps, like the NeHe examples do.
    I understand that you're doing it the recommended message handling way. If you want to have a reduced load in a continually animating window, you could add a WM_TIMER handler and setup a timer event which refreshes at a lower rate. During the repaint the OpenGL driver might still max out your CPU during that time, because it's designed for maximum speed, not for low CPU load.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •