OpenGL question

This is a discussion on OpenGL question within the Game Programming forums, part of the General Programming Boards category; My program is just a 3d object spinning around made up of quads and triangles textured with a bitmap. When ...

  1. #1
    ---
    Join Date
    May 2004
    Posts
    1,379

    OpenGL question

    My program is just a 3d object spinning around made up of quads and triangles textured with a bitmap. When its running it constantly uses 99% cpu cycles. I have seen someone post a question like this before not sure if it was this board or not but there solution was for win32. I am using opengl thru SDL. Is it normal for a simple program like this to use so much cycles? How can I fix it?

    [edit] another thing, why would it constantly be running at 22fps no matter what resolution its in or how many quads/triangles are on the screen or whether its in fullscreen or not. [/edit]

  2. #2
    Registered User
    Join Date
    Apr 2002
    Posts
    1,571
    Try adding a call to Sleep in your main message loop. This will give the cpu a chance to handle other tasks.

    I'm not sure about your fps problem though. Are you sure your timing code is right? Have you tried switching release/debug and seeing the difference?
    "...the results are undefined, and we all know what "undefined" means: it means it works during development, it works during testing, and it blows up in your most important customers' faces." --Scott Meyers

  3. #3
    ---
    Join Date
    May 2004
    Posts
    1,379
    thanks mrwizard
    the problem was the bmp i was using was high res.

  4. #4
    Software Developer jverkoey's Avatar
    Join Date
    Feb 2003
    Location
    University of Waterloo
    Posts
    1,903
    >>When its running it constantly uses 99% cpu cycles.
    Most programs that run in real time should take up 99% of the CPU...thus the reason we call them "real time"

    >>another thing, why would it constantly be running at 22fps no matter what resolution its in or how many quads/triangles are on the screen or whether its in fullscreen or not.
    You're calculating the frames per second wrong.

  5. #5
    ---
    Join Date
    May 2004
    Posts
    1,379
    well i was using a program called fraps http://www.fraps.com/
    maybe its not working properly but im almost certain that it is.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. OpenGL Question
    By Halo3Master in forum Game Programming
    Replies: 16
    Last Post: 10-02-2007, 03:40 AM
  2. Opengl question
    By Shadowwoelf in forum Windows Programming
    Replies: 3
    Last Post: 06-03-2007, 02:21 PM
  3. OpenGL Camera Question
    By Astra in forum Game Programming
    Replies: 2
    Last Post: 03-25-2007, 02:53 PM
  4. OpenGL Question
    By Shamino in forum C++ Programming
    Replies: 5
    Last Post: 05-05-2005, 03:35 PM
  5. OpenGL and Windows
    By sean345 in forum Game Programming
    Replies: 5
    Last Post: 06-24-2002, 11:14 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21