I am developing a video game, it has some VERY good potential at the moment.

It is a full-fledged RPG, using 2d Sprites, OpenGL, many very good songs, and about a 9 person team.

I am the sole programmer, we have one sound artist, and the other jobs include:

map design
level design
quest design
battle system
magic/item systems
graphics artist (still looking)
plot design

Also, the game uses a VERY efficient engine I created that allows you to just put the data in to a matrix (can’t say too much, or I’d be leaking too much)

And one more note of information, I am a well-known, and appreciated programmer. I am 15 years old, a sophomore in high school, and I am in accelerated Algebra II, and have taught myself about 8 languages.

Now, to my question!

I was wondering, I know there is a way, but I can’t find any decent tutorials on the topic, but how do you get a program to draw a background, and say, save it to a buffer, so that you can draw things on top of it, refresh it, and only have to draw the sprites again, and not the background…this would GREATLY increase the speed of my engine.


if you have an answer to this, please email me at

You’re going to have to draw the background again. The only real question is whether or not you have to draw it made from its individual elements.

On the assumption that your background is a tilemap (I’ll get into this asthetic issue in a moment), you have two options to speed up how fast it draws. You can render the tilemap, from the separate tiles, to a texture directly, using ARB_render_texture. Or, you can use glCopyTexSubImage to copy the framebuffer (containing just the tilemap background) to a texture. In both cases, you will need to render the texture to the framebuffer again, but you won’t need to do all of the texture swapping and so forth that rendering it from the tilemap will do.

BTW, unless your tilemaps are rather small (say, 32x32 tiles with a map being no larger than 128 tiles on any axis), this isn’t going to work very well. Mainly, because even a GeForce 4 can only have 4096x4096 textures, and 32*128=4096. So, you will not be able to render the entire tilemap into a buffer at once. Not only that, even if you did, you’d be taking up enormous ammounts of memory to do so.

In any case, a tilemap is not very complicated. I would guess, on modern cards (GeForce or better), you should be able to get at least 10 layers at 800x600 using 32x32 sprites drawn in OpenGL with quads. GL rendering is probably not going to be your performance bottleneck.

As such, my personal suggestion is to not bother. Just using OpenGL at all will give you plenty of performance, given the requirements of the game and so forth.

On an asthetic point: how can you possibly get away with this? Do none of your tilemaps support multiple layers where sprites can be in front of one layer while behind another (allowing sprites to be hidden by a tilemap)? Even if you don’t have layers in front of sprites, you can’t use paralax scrolling if you want to try this rendering method.

BTW, I hope, for your sake, you get more programmers on the project. An entire RPG is not a simple or trivial undertaking, even with the best design in the world.

Also, the game uses a VERY efficient engine I created that allows you to just put the data in to a matrix (can’t say too much, or I’d be leaking too much)

Sorry; doesn’t impress me. Of course, since you didn’t say anything about what the “data” in question might be (graphics, sound, plot, etc?) or what this “engine” does (graphics, sound, plot, etc?), how could it? I have no idea what you are referring to.

if you have an answer to this, please email me at

Sorry, this is a public forum. If you want answers, you’ll have to come back to see them.

ok, well, i understand what you mean, and first off, I’ll admit, my engine’s probably not the most efficient one in the world, but it does the job. And, about the game itself:

[ul][li]the game is tile-based, with grids of 24x32 (24 down, 32 across).[]There is a single character in the center of the screen, and in a sense, the world revolves around him/her, hehe[]I have fixed it a bit so that it is zoomed in and only displays a 12x16 screen[]Also, instead of drawing the whole tile all the time, it will draw only 14x18 tiles, one minus on the top and left sides, and vice versa with the left and bottom[]I have made a couple particle engines, one of them is for snow, the other is rain, and they can be displayed on top of the tiles[]Also, every one of the tiles in the game has it’s own value on the z plane, allowing me to place where something is being viewed[/li] [li]Background= -3[/li] [li]Any location tiles (the houses, etc)= -2[/li] [li]Character= 0[/li] [li]Engines= 3[/li] [li]And anything else I think of will be in between[]I use Ortho view, to simplify everything (no point in 3d, and I can just switch anyways)[]Almost all of the tiles in the game are put in a 16x16 tiles 64x64 pixels picture, and are then shrunk down to 32x32 in the game, this saves the number of pictures I’ll need in the end[]The game has only been hatched so far, therefor it is not really ready for anyone not on the team to view, sorry[/ul][/li]Thank you, and I hope that this will simplify some things so you know a bit more about it

[This message has been edited by jverkoey (edited 11-23-2002).]

[This message has been edited by jverkoey (edited 11-23-2002).]