Objects?
er, how can I make an object, lets say a couple of quads which will stay around, persist, so that I can do stuff with it? Its a pain in the ass to have to make the cube every time it loops, why can't I define it and have it stay defined?
OpenGL has no memory of what's been drawn, and no concept of "an object". You have to draw everything each frame because you might want to draw something different each frame.
Why can't you just make a function called drawCube() and call that each frame?
OpenGL does have the concept of a "display list", which is a set of OpenGL commands you're going to issue over and over again. These get "compiled" and stored on the video card. Then all you have to do is call glCallList(). For something like a cube, though, they're probably slower than drawing it each time yourself by hand
Why can't you just make a function called drawCube() and call that each frame?
OpenGL does have the concept of a "display list", which is a set of OpenGL commands you're going to issue over and over again. These get "compiled" and stored on the video card. Then all you have to do is call glCallList(). For something like a cube, though, they're probably slower than drawing it each time yourself by hand

Just to be complete, there are also vertex objects, which are closer to what you are asking for but overkill for "a couple of quads".
Quote:Originally posted by OneSadCookie
OpenGL does have the concept of a "display list", which is a set of OpenGL commands you're going to issue over and over again. These get "compiled" and stored on the video card. Then all you have to do is call glCallList(). For something like a cube, though, they're probably slower than drawing it each time yourself by hand![]()
Kind of offtopic, but i'm doing keyframe animation of a person moving, would it be the fastest to use a array for each keyframe, and then just interlope and send the polygons to the video card, or to make 60 or so frames and load them into lists at the start of the game? I will only need a few animations in my game if that matters.
This sounds like a classic performance vs memory requirements question.
If you can spare the memory, 60 pre-computed display lists would be faster than computing the animation for each frame.
BUT! 60 pre-computed display lists will take more memory and be less flexible.
If you can spare the memory, 60 pre-computed display lists would be faster than computing the animation for each frame.
BUT! 60 pre-computed display lists will take more memory and be less flexible.
About the keyframe thing, it might be safer to assume that at some point you will have more than a few animations, and caching all the frames won't be practical from a memory standpoint. Linear interpolation shouldn't be any slower than, say, skeletal animation, and a lot of games are doing that in real time now. So you might consider just interpolating in real time from the outset.
Level of detail selection can help here, but that's a whole other topic...
Level of detail selection can help here, but that's a whole other topic...