Part of the Khronos Group

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 2 of 2

Thread: Animation too slow

  1. #1
    Newbie Newbie
    Join Date
    Oct 2014

    Question Animation too slow

    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?

  2. #2
    Senior Member OpenGL Guru
    Join Date
    Jun 2013
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts