View Full Version : triangles or polygons
07-28-2003, 07:06 PM
First of all, hello to all (i'm new). I got a question. I read that a triangle takes a lot LESS CPU to draw than a any other polygon. How true is this? Is it worth it to make all my polygons out of triangles?
Another question. I made a very small program where a cube moves through the screen and rotates, and i checked the CPU usage and it was at 100%. Is that normal?
Sorry if they're dumb questions...=)
07-28-2003, 11:27 PM
OpenGL can only render triangles, when you try to render a polygon (convex only) OpenGL will break it down into triangles for you, this will take a little time but I don't know how much, concave polygons are a different thing, this has to be tesselated into triangles before they can be used by OpenGL, the best thing is to keep it all to triangles /and strips and fans) to make sure you get the best performance.
If your application is using 100% CPU it has nothing to do with OpenGL, I would guess that you are using Windows.... the best guess here it that your messageloop is a bit ugly and snatches all the CPU power, if you make a game or something it may not matter at all, but it might be worth heving a look at, if you don't have a Sleep() or one of the Wait...() functions in there your app will eat 100% CPU power, it's as simple as that.
07-29-2003, 08:10 AM
You're right, I am using Windows. My message loop goes something like this:
I realize that unless there is a message, I am redrawing everything every time around the loop. What can I do to prevent that?
07-29-2003, 12:12 PM
You don't want to prevent that. That's how graphics programs work - you draw every time through the main loop!
Now, if you have a lot of objects in your scene that aren't visible (like things behind you or way off in the distance), there are techniques to prevent sending them through the graphics pipeline. Do a search on "frustum culling" to learn more about these techniques.
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.