Hello, I am working at a 2D game and wonder how I draw images. I have search and I only found how to load textures.
You have to render quads using OpenGL, and bind textures to those quads.
If you want to use OpenGL for 2D games development, you have to read up on OpenGL :)
It sounds cool! :D I have no idea how to do that, but I maybe find a tutorial somewhere...
Maybe I should do something other than OpenGL if I want to do a 2D game?
There are simpler alternatives, yes.
Allegro and Simple Directmedia Library are two popular alternatives.
I think there is some 2d-library built ontop of OpenTK too, but I don't remember the name right now.
Checkout agatelib which is designed specifically for 2d games. It builds on OpenTK and makes things way easier than raw OpenGL.
Agatelib is sloow.. :( It take time to run a "hello world" program while my program written in OpenTK is faster.
And I have no idea how to install Allegro and it seem to support BMP files only and not PNG or GIF. It's only for C++ and I want to use C#.
But I should check Simple Directmedia Library! :) Is is same as Simple DirectMedia Layer?
Yeah, SDL = Simple DirectMedia Layer. I might have confused the name (or have they switched recent years..? Library seems more natural to me..).
Anyway, SDL is for C natively, with wrappers for C# (Tao has a SDL wrapper IIRC). If you want to use C# I think AgateLib is a more appropriate choice.
If you are developing a "simple" 2d-game, using ordinary Windows.Forms Graphics might be OK though. You have .png support then (built into .NET platform), but you will have to find some audio library.
SDL seems to be very hard.. :S I even tried SDL.NET, but I cannot get it to work.. And doesn't Windows.Forms Graphics only works in Windows? I want to do a cross-platform program.
If there is anyway to speed up AgateLib I am gonna use that. The game I want to build will be big and I don't want that it should take years to load it.
"And doesn't Windows.Forms Graphics only works in Windows? I want to do a cross-platform program."
Works on linux/mac too, so you can use it if you want, it isnt 3d accelerated so speed isnt so good what
Windows.Forms are cross platform, but rendering speed is not that great (no hardware acceleration). Edit: beaten :)
Are you judging agatelib from it's startup performance? If so, give it another look, there are ways to improve this.
Startup performance depends mainly on the amount of assemblies you link against, because every assembly must be loaded, linked, verified and jitted before use. You can use ILmerge or mono.linker to merge your assemblies and reduce this kind of overhead.
The second consideration is the size of the code that must be jitted: the larger the code, the longer it takes to JIT. For example, OpenTK used to take 2+ seconds to load at first, because its OpenGL bindings contained several thousand lines of setup code. Replacing this with reflection brought eliminated the JIT cost - the OpenGL bindings now take ~40-200ms to load (depending on the runtime and drivers - Linux tends to be faster here). You can use AOT (ahead-of-time) compilation to completely eliminate the JIT costs.
However, the third and most important piece of the puzzle is asset loading. Once you add non-trivial graphics, audio and (even worse) networking, you'll see that the startup cost dwarf in comparison. Unfortunatelye, there is no silver bullet for this problem other than planning ahead the implementation.
What kind of loading times are you aiming at? Are you planning to use some kind of streaming system to avoid loading screens completely (ala Halo)?
Well, I don't want to have a super fast loading system or a streaming-somewhat. The loading speed when I use OpenTK is fast enough.
But the Agatelib adds loading time because you have to go Agatelib->OpenTK->OpenGL...
Now I get SDL.NET to work and looks simple to use! :) But I have only manged to draw a circle at the screen...
Site design by Stefanos A. Icons courtesy of gnome-colors.