Wednesday, 15 April 2015

c++ - animating a model without redrawing the whole background drawing --OPENGL -


Using OPENGL, I am creating a simple animation where a small triangle will proceed along the path I made with the mouse (glutMotionFunc).

"post-text" itemprop = "text">

).

So the problem is how I glutSwapBuffers (); I can animate a small triangle without redrawing the entire path using

and also, how can I just rotate that triangle?

I do not want to use overlay to switch between these two layers because it takes a lot of time

If the whole path is really very expensive to recreate, then you can do an rendering of an off-screen framebuffer. To do this with OpenGL, the mechanism is called the Frame Buffer Object (FBO)

How detailed the details of the FBO have been made, the answer is beyond the scope here, but you can find the tutorial should be able. You will use functions like:

  • glGenFramebuffers ()
  • glBindFramebuffer ()
  • glFramebufferRenderbuffer () or glFramebufferTexture ()

In this way, you can only draw an additional triangle in your FBO A new triangle has been added. To show your rendering on the screen, you can press glBlitFramebuffer () . By using

you can copy the current content of the FBO to the primary frame buffer.

No comments:

Post a Comment