View Full Version : Animation too slow

10-22-2014, 09:49 PM
Hello guys,

how's everything?

So, I'm trying to make a 2D game (a very simple one). I'm doing step by step and this is where i've got so far:

The game is a tank moving in a arena (with obstacles). So, first I made a program that reads a svg file (that contains lots of rectangles and circles) and draw the same rectangles and circles on a window (btw im using ubuntu 14.04 and freeglut). After that I started a new project to draw the tank and make it move around the screen and shoot a ball when you click the mouse button. And its working very well.
But when I try to combine both its where the problem begins.

The first program (that reads the svg file and draw the rectangles and circles on screen) is very heavy and everytime i move the tank the OpenGL redraw the entire scene.

So, is there a way that I can draw the arena once and when i move the tank the OpenGL only redraw the tank in its new position but doesnt redraw the arena?

10-23-2014, 08:02 AM
First you need to consider why redrawing the entire scene is a problem. 3D games invariably draw the entire scene from scratch every frame, and manage to do this 30 times a second with hundreds of thousands of poylgons, complex shaders, and a gigabyte of texture data.

In any case, the usual way to do what you're asking is to render the background into a texture (see glFramebufferTexture etc) then just draw a textured quad each frame.