lubos's picture

2D Graphics Engine

Hello, so I'm slowly progressing with my OpenTK, OpenGL and whole C# adventure. I'm taking opportunity to start development diary so here I am :) I have started writing a small engine with OpenTK, that handles ONLY 2D rendering, but completely removes need to use any OpenGL function, while cooperating with other parts of OpenTK. I haven't decided for the name yet but that's not important I think.

The goal is to build a small, easy to use engine capable of building small 2D games together with OpenTK.

Engine doesn't use any scene-graph, you must draw each image every frame manually. I think this way it's cleaner and faster when working with 2D graphics. However, Gui uses a GuiManager which will draw all widgets at once.
To use engine, engine code is linked directly with game code. If you don't need some parts of engine you just don't link them.

The colors are passed as unsigned bytes (0-255).
The positions and sizes are passed as integers, meaning the x and y position of pixel on screen, where 0,0 is in the top left part of the screen.

Features implemented:
- Images loading/drawing (rotating, scaling, blending, drawing part of image)
- Animations(Sprite) (frames rendered from one texture, same options as image)
- Particle systems (uses single VBO, Point sprites)
- Custom VBOs

Features planned:
- Basic Gui(first widgets done)
- Complete documentation/examples(some examples done)
- Shaders

Free Image Hosting at www.ImageShack.usFree Image Hosting at www.ImageShack.usFree Image Hosting at www.ImageShack.usFree Image Hosting at www.ImageShack.usFree Image Hosting at

Mines.zip464.13 KB
PointSprites.zip467.25 KB
Game.zip476.52 KB
Engine.zip23.6 KB


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
lubos's picture

I have removed all textPrinter.End(); calls and everything is displayed ok again

lubos's picture

New features! Now when VBOs aren't supported, intermediate mode is used instead. Also point sprites are done, see new screen or try attached application. It uses 15k particles and runs on 76 fps here :)

the Fiddler's picture

The new particles are great, especially the second screenshot!

lubos's picture

I have coded another small game. The menu is not yet finished, but it does all that I wanted it to do. While coding this game I have found many things which was missing in engine, but I think it's getting better :) The next thing on the list is a Group class, that can modify all objects added to it at once, like move them or rotate them. And the Effect class for shaders.

lubos's picture

Hello! I'm still updating engine. I will upload code tommorow, maybe someone can find it useful. It's still missing some nice things which I'm planning but I hope to implement them all sometimes. Added a screenshot of my current project using engine, I'm trying this one: .