Page 1 of 1

Which API for 2D Graphics? The Future?

Posted: Tue Jan 06, 2009 12:22 pm
by Violet
I'm really torn, I cannot decide if I should use 2D APIs like the PureBasic Sprite and Screen Library (SDL) or modern 3D APIs (OpenGL would be my favourite).

"Old" 2D APIs
  • They write the Sprite information directly into the Video Buffer (in SDL called "blitting") which works very fast
  • Since Screen Resolutions are getting very high sprites get smaler on the screen (if they are not scaled somehow, that's something important what's missing)
  • Work nearly everywhere
"New" 2D APIs (in reality 3D APIs like OpenGL)
  • Fully hardware accelerated transformation (rotation and scalation)
  • Fully hardware accelerated effects (alpha blending, different blending modes, anti-aliasing)
  • Automatic Depth Sorting
  • If programmed right, they are resolution independent (ok, there's a point where low resolution images get blurry at a big scalation/resolution)
  • No Driver, No Screen to draw on!
  • 3D Games and APIs are already so popular, DirectX and OpenGL are getting standard APIs for Game Graphics(, aren't they?) and seems they are going to be the future
  • Windowsize independent resolution of the graphical output (A 320x240 Screen can be stretchted to a 800x600 window, the pixels are just interpolated)
What's the better decision? I just can't get familiar with the imagination I programmed a 2D game, which optimum resolution is 640x480 and making it work for 1280x800... because everything will look so small. Since in PureBasic a scaling Option for Sprites is missing (I already know such "work-arounds", but they look really ugly, not like I could smoothly scale an image on a quad with OpenGL) it's not really possible to make a game look always the same (just sharper with higher resolutions).

I already wrote the "Illusion Graphics 2D" Engine based on OpenGL some time ago, just published in the german forums (windows only).

A by-the-way question from is also: if I write a user interface for PureBasic's standard Sprite&Screen Library which works with windows which can overlap, how do I do the Z-Sorting? Example: I press on the button on the foreground window, but how do I detect that this button was pressed, and not the button on the background window at the same position?

I just don't know what to do! :)

Subforum

Posted: Tue Jan 06, 2009 1:15 pm
by Violet
Oh, I saw... is this maybe the wrong Subforum for this Topic?

Posted: Tue Jan 06, 2009 1:17 pm
by DarkDragon
DirectX is both: DirectDraw (Blitting) and Direct3D (Vectorgraphics)

Posted: Tue Jan 06, 2009 1:25 pm
by Violet
I knew that, and because of that I wasn't sure to mention DirectX, also it's just windows. In that case the "old" API would be DirectX Blitting and the "new" API Direct3D.

Posted: Tue Jan 06, 2009 4:26 pm
by Rook Zimbabwe
Are you planning to offer us your Illusion Graphics 2D engine? Nicht Wahr? :wink:

The Wayne Train! *wayne**wayne*

Posted: Tue Jan 06, 2009 6:21 pm
by Violet
:lol:

I gave up Illusion Graphics because after that I worked with C# and XNA and other stuff, did a trip in game programming until I got stuck. Until I arrived at a point where I didn't know where to, because somehow I lost the ability to make decisions. Not longer just the API was the question, the language, the engine (self-made or other), a.s.o.

I tried to write a UserLibrary (maybe the best way for that) based on OpenGL, a Sprite&Screen library, but I got lost helpess within the linking affair. (see here)
Also my plan was, to maybe make a OpenGL Wrapper for PureBasic, could be useful. But on Linux only (it's much easier there, I think).

The question now is primary for myself, for my own projects, not directly for creating another API. But that would be really fun to integrate a 2D OpenGL based API neatless into PureBasic (on Linux). Just no getting further because no one knows how to handle the linker problems...

Posted: Mon Jan 12, 2009 10:59 pm
by Psychophanta
I'd answer 2D AND 3D Directx API for 2D Graphics.

Posted: Wed Jan 14, 2009 4:39 pm
by Violet
And why that?

Posted: Wed Jan 14, 2009 9:27 pm
by Psychophanta
Because I find DirectX (its 3D and 2D API functions) the best thing for 2D stuff.
No doubt it is faster and more powerful than SDL and other similar libs.

However i don't know if OpenGL has power for 2D graphics, and also i have not made a serious DirectX 3D vs OpenGL comparison, but only a superficial comparison and DirectX is best if well programmed imo.

EDIT:
In short: for the future of 2D graphics i bet for DirectX.

Posted: Wed Jan 21, 2009 11:24 pm
by dracflamloc
Opengl is suprisingly simple to get going for basic 3d-accelerated 2d graphics, and it pretty nice when it comes to adding 'extras' because as a state-based API you just need to change the states at certain times to achieve certain effects.

I've never really 'directly' used directX so I cant comment there, but I've made plenty of 2d games with openGL and it was pretty simple to do.

Check out my most recent:
http://www.dracsoft.com/#58

Posted: Thu Jan 22, 2009 12:49 pm
by Violet
Seems like I know, on which I continue programming the next time. 8)