Directx, GDI, Opengl

Started by
8 comments, last by Dreq 17 years, 9 months ago
For my engine i decided on Directx 9 ..sprite based rendering... now im starting to think i made a mistake. I don't really find myself needing all the firepower of directx and im wondering if its doing me more harm than good. I am considering moving my engine back to GDI+...it wont be hard because my rendering engine is seperated from my game almost entirely. Is there really a reason why i should stay with directx when im making a purely 2D game? I know everyone who wants to play will have to have a d9x compatable card and i dont know that i want to force that on people just to play a tiny 2d game. yes i could do more than one renderer...but i dont have time for that. so...if anyone knows of a good compairison between the different rendering methods or knows of a reason why i should choose one or the other please let me know.
Advertisement
It's not a comparision, but opengl has both 3d and 2d rendering functions for each primitive, so you can draw in 3d and 2d mode. The old irix gui used the 2d gl set for rendering its windows. Opengl 1.2 is more than enough for this job, and takes advantage any of acceleration when present. If there is no 3d card in a computer, opengl will fall back to software mode and that is what the old gdi library uses most of the time.

Viktor

ps: I suggest you to go with opengl. It's easy to learn (especially the 2d part). The only catch is to use the 2d coordinate system and the 2d version of textured quads to render sprites. (it gives you free rotation, scaling and optional transparency and alpha blending) The whole thing is present in windows since win95.
If you're not familiar with using OpenGL for 2d graphics plotting you might try using hxRender as a wrapper.
I have to stress how much easier it will be to go back and use GDI+... you don't have to worry about resources, drawing shapes is a whole lot easier and the performance let down doesn't even matter since it's 2D. Plus you get a ready-made GUI system. DirectX just begs for errors with resources, rendering, etc. - more trouble than it's worth. :) That's just my opinion from experience, so I'd urge you to go back to GDI+ and focus on the design. Good luck anyway.
Im really not worried about what language I choose...i just have to find the right interfaces to call...

what i am most worried about is the fact that i cant run my game on a machine that doesnt have a dx9 capable card....Its an isometric game for christ sake.


Now..that being said...


how much of a performace hit am i going to take going back to GDI ya think?


i did run mornings wrath using gdi and it was A LOT slower on my system than directx.

it may have been a bug or something but the GDI renderer did not do well.

directx was nice and smooth.
Perhaps you should use DirectDraw?
Look at the two Isometirc Engines at http://www.isogames.de
They are written with DirectDraw
Well it actually depends on if you would like to take advantage of the GPU. If you would like to do special effects with Shaders then go with OpenGl or DirectX. If you have no need for any special effects, and are doing a pretty simple 2D game, then GDI+ should be good enough.

You'll of course loose the GPU accelration, and will be unable to use hardware accelerated texture blending, etc. The GDI is going to be slower because it does not take advantage of hardware acceleration. However, depending on how complex your game is, it should be alright.

Direct Draw, although depreciated would be much easier to do an 2D game with then Direct3D. I would suggest giving it at least an look.
Quote:Original post by samuraicrow
If you're not familiar with using OpenGL for 2d graphics plotting you might try using hxRender as a wrapper.


ClanLib is another choice.
I've decided to stick with directx and use 2d sprites for everything...this seemed the easiest and most extensible for the future.

thanks for all the replies.
Yeah, I personally use DirectX9's Direct3D in C#, and I get about 2000fps.. The other plus is pure aplha layer support. The only thing I have to concidered with this method is making my tiles and images power-of-two. This means using either a 1024x1024 texture or two 512x512s side by side for a 640x480 full screen image (i opted for 1024x1024 for simplicity). Basically, after I created my art, I converted to .dds (i think thats correct) using the DirectX SDK's texture tool.

[edit]
Of course this approce requires 3D acceleration for the most part, so if you don't want it, you can always use direct draw as suggested above.
"Mommy, where do microprocessors come from?"

This topic is closed to new replies.

Advertisement