Teen Programmers Unite  
 

 

Return to forum top

DirectX VS OpenGL in 2D

Posted by CodeMaster [send private reply] at January 02, 2002, 01:12:01 AM

After getting a few books and reading a few webpages I have found OpenGL code to be easier to draw in. But I want to make 2d games and I am not sure what API to use. I have gone through some DX tutorials and am starting to understand the object style of programming bets its still weird. AAARRRRrrrr I just want one of them to die off so I know which to use :)
(Thanks for hearing me vent)
(Any thoughts appreciated)

Posted by gian [send private reply] at January 02, 2002, 01:29:10 AM

For 2D I suggest SDL... portable and simple.
www.libsdl.org (I think...)

Posted by CodeMaster [send private reply] at January 02, 2002, 04:33:12 AM

Thanks, I took a look at it but i don't think I have the patients to learn another API.
(but it is 4:35 in the morning so maybe when i wake up if I goto sleep I will think differently)

Posted by KeNnY [send private reply] at January 02, 2002, 09:54:04 AM

If you want 2D to make some kind of GUI for a game or something similar, you can use DirectDraw or SDL, but to make someting impressive (or not :] ) it's better to use OpenGL. Look at the gui of Return to Castle Wolfenstein game for example, weally beautiul :] (made with opengl of course). It's also possible to do the same with Direct3D (ou DDraw), but.......... personaly I don't like it. OpenGL
is easyer and works almost on every machine, but DirectX.... no comments :]
Anyway, it's up to you now...
Keep coding :]

Posted by DakeDesuDx [send private reply] at January 02, 2002, 10:11:47 AM

I think the only reason M$ does not develop products for Linux is cause it would make Linux nolonger a viable competetor according to the Supreme Court.

Look what happened when Bill Gates gain control of his evil pet sock puppet's Company, Apple.
It would not surprise me to see DirectX available for Mac OSX sometime soon,

Posted by gian [send private reply] at January 02, 2002, 03:17:39 PM

Yeah, well Macs are basically Unix x86 PCs with some proprietary over-priced hardware thrown in to give it that good old "Home brewed at apple" feel. Of course this makes development on them quite hellish :-) And they've used an open source kernel, but will not opensource the rest of their OS.

Posted by max621 [send private reply] at January 02, 2002, 03:19:00 PM

Go with DirectX for 2d. OpenGL is not designed for 2d. Its all for 3d. Sure you can do 2d, but its much slower then DirectX from what I've heard. Or of course just do SDL :)
I really wanna learn how to make a GUI in OpenGL... wondering if it requires picking and what not.

Posted by Psion [send private reply] at January 02, 2002, 03:28:14 PM

Making a standard windowy GUI in OpenGL is easy, and it doesn't require picking if you know how to tell if a point is in a rectangle. ;-)

Posted by sbennett [send private reply] at January 03, 2002, 07:33:04 AM

For an OpenGL GUI, use glOrtho(), make the modelview coordinates match up to the pixels on the screen, and then the coordinates of the mouse are also the position in your 2D 'World'. If you can follow that.

Posted by max621 [send private reply] at January 04, 2002, 02:46:35 PM

... no I don't follow that at all, lol.

Posted by Psion [send private reply] at January 05, 2002, 04:43:20 PM

Guess it's time to break out that documentation, then, eh!

Posted by Johnny [send private reply] at January 05, 2002, 06:14:25 PM

This is really a context sensative question. It's all a matter of the game you're making. DirectDraw would be good if you're looking for pretty standard 2D graphics, but if you want to easily add various effects, and some layers to your 2D environment, but still have 2D gameplay, OpenGL or Direct3D would do well. SDL is also a nice one, as it's portable and fairly easy to use. Also keep in mind what type of end user you're aiming for. If it's a person with a Pentium 100 MHz, 16 MB RAM, and Windows 95, I'd recommend DirectDraw. If you're aiming for someone with a more advanced system (like, anything over 300 MHz, perhaps with some type of 3D hardware acceleration) Direct3D or OpenGL would be good. Really there are a lot of variables in that question, and I think the answer lies in what kind of game you want to make, where you want to go with it, and what you want out of the development process.

Just my 2 cents,
Johnny Watson

Posted by metamorphic [send private reply] at January 15, 2002, 12:38:39 PM

Not to mention that both API's do EXACLY the same damn thing, create an interface between the graphics hardware and the programmer. Use whichever of the 2 API's you feel more comfortable with

Posted by DakeDesuDx [send private reply] at January 15, 2002, 05:17:09 PM

metamorphic, I do not think the question was about what the results were, which I doubt are exactly the same (CPU and Mem usage-wise), I think he was asking which was easier to learn.

My answer is, prolly, for a 2d interface, go with SDL, while it currently is not industry standard (close though) it is the easiest to learn imo. I picked up a book on Direct3d, and though I did not really know C at the time as well as I did now, I found I was a little overwhelmed by it. So unless I could pick up the book today, look at it, and say, man I must have been some dumbass when I read this (in reference to how much of a dumbass I am now), I will have to suggest SDL.

OpenGL, last I checked, was not really meant for 2d. So I would think it would be like using a knife as if it were a fork. Sure you can do it, but generally it is easier to understand how to do it with a fork.

You must be logged in to post messages and see which you have already read.

Log on
Username:
Password:
Save for later automatic logon

Register as a new user
 
Copyright TPU 2002. See the Credits and About TPU for more information.