I'm new at OpenGL. Basic开发者_运维百科ally I want to know how to resize a rectangle. For example: I have a rectangle, height = 10, width = 20. I want the rectangle to grow 90 points up in 1 second for a new height of 100. Is there a function that can do this? Or I'll have to do it frame by frame?
Thanks
You'll have to do it frame by frame. OpenGL is a graphics library, not a physics engine or game library; it only provides functions for drawing primitives (triangles, quads, etc.), not for manipulating "objects" on any higher level.
As Jesse Beder replied, You have to do this in each frame, and manage all of the time yourself. Since OpenGL is not a retained mode graphics engine, each frame needs to be drawn manually.
However, you do not need to actually resize your rectangle each frame. You can, alternatively, just change it's transform. You can use glScale/glTranslate, etc, to just change how the rendering is done, which will effectively make it "grow".
精彩评论