Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

ToasterFace

Whats easier DirectX or OpenGL

This topic is 6151 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I was just curious what some programmers think about DirectX versus OpenGL, such as which system is actually easier to use? HAVE SOME TOAST DARLING! OR I WILL BEAT YOU!

Share this post


Link to post
Share on other sites
Advertisement
Do a forum search for MANY discussions on this topic, its been worn out a long time ago

FatalXC

Share this post


Link to post
Share on other sites
It''s simple ... if you ever want to consider writing for more than just windows use OpenGL ... otherwise, (if you''re sensible) use OpenGL ... not that i''m biased at all ... but OpenGL is much easier to use, and you''re not restricted by microsoft!

Share this post


Link to post
Share on other sites
I also have a question..
I know the choice is ours whether we use Opengl or Directx.. either one is usable, but I was wondering. Since Opengl is 3d Orientated is it possible to do exactly the same things, and/or the same quality as DirectDraw, or the 2d Side of D3d?

I''ll explain myself a little better...
Say If I wanted to make a 2d RTS Game.
Could I use Opengl for this?
I would like to use Opengl seeing the code(in my opinion) looks simplier and easier to understand.
But Would I have to use Directx? (2d through D3d now with Dx8)
The main reason Im asking is, even though you guys have alot of Flame wars about DX Vs OGL, Most of you hardly mention whether its 2D or 3D your refering to. 3D though is mostly the obvious ''subject'' of them. Although I''d just like to know whether Opengl capabilities for 2D are just as good and worthwhile as 2D In Directx..

Thanks


- ]Reaper[

Share this post


Link to post
Share on other sites
In terms of basic functionality, to be fair, there is very little between the 2 API''s ... they can both do the same thing ... but let me say this ... i am a VB programmer by trade (using the Windows API all the time) ... i know software ... i looked at both API''s, and basically shrugged off direct whatever as a waste of time ... it''s less intuitive than OpenGL, non transportable, and dependant open one vendor - Microsoft ... which to me is a BAD thing!

Share this post


Link to post
Share on other sites
You can use a 3D API such as OpenGL or Direct3D/DirectGraphics to draw 2D graphics. So, no, you don''t have to use DirectDraw. If you use a 3D API, you have the benefit of hardware acceleration for things like blending and interpolation. The downside is that you have to deal with texture issues (like the infernal 256x256 limitation imposed by many Voodoo cards), and actual drawing will be done in terms of polygons projected orthographically. So, to draw a "sprite" in a 3D API, you do something like this:

- Set up an orthographic projection (in OpenGL you can do this using the GL Utility Library function glOrtho2D)
- Load a texture for the "sprite." The image should have an alpha channel to represent the transparent regions
- Bind the texture to the active texture unit (in other words, use the "sprite" texture)
- Enable a blending mode that will make the transparent regions in the "sprite" texture draw transparently (in OpenGL this would be done with glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA))
- Draw a quadrilateral using the "sprite" as the texture

Again, the benefit of using a 3D API is that all of this will be done with full hardware acceleration. If you use a 2D API such as DirectDraw or Allegro, the steps are somewhat simpler:

- Load the sprite image into a surface which contains a certain color to represent the transparent regions
- Tell the API which color will be treated as transparent
- Blit (copy) the surface to the active screen buffer (the back buffer or inactive page)

While that looks simpler, consider that this will all be done in software, which means that the API has to test every pixel in the surface, deciding whether or not to draw it. Worse, you won''t get arbitrary levels of transparency like you can with a 3D API (well, you can, but it''s not something built into any 2D API I know of).

So, those are your choices. Honestly, I''d use a 3D API to do 2D stuff.

As for which 3D API is easiest...
Honestly, they''re about the same by now. They didn''t start out that way; Direct3D used to be very messy and klunky, but has become increasingly OpenGL-like (in other words, is has become more procedural). It also used to require tons of initialization, but now that''s accomplished using some simple functions, so that initialization is about as simple as initializing OpenGL. But speaking strictly of the API, many programmers still feel that OpenGL is cleaner and programmer-friendly (John Carmack still holds this opinion, though he fully acknowledges that Direct3D 8 has become very good). Also, OpenGL has the potential to exploit features much sooner through its extension mechanism than in Direct3D.

My suggestion is to use OpenGL. It''s simple, friendly, platform-independent, and fast.

Share this post


Link to post
Share on other sites
Thanks

I will learn Opengl Now.. Even just thinking about me having to learn Directx gave me a headache Microsoft too! ugh.

Thanks Again

- ]Reaper[

Share this post


Link to post
Share on other sites
I''ve used DirectDraw, and I''ve used OpenGL a little.

One thing I really like about OpenGL is that it doesn''t require a bajillion classes to work. That makes creating OpenGL wrappers easier.

One thing that everyone says (and it is true) is that OpenGL and DirectX are tools. If you want to make a 2d game, pick the one that works the best.

If you are going to make a tile based game with all your sprites being 64x64 or something, then 3d is definately a very good way to go. Of course, that doesn''t decide whether Direct3D or OpenGL is better.

If you want to do something freaky like rendering on the desktop, having sprites fly out your window (Like Catz or Dogz), or if you want to display sprites bigger than 256x256 and don''t want to worry about video cards not being supported, DirectDraw (Dx7)is probably simpler.

I''d try out both. There are people that use Direct3D, and there are people that use OpenGL, and both groups swear by that api. Therefore, I''m lead to assume that both apis are great, but they require different styles of programming, and Direct3D fits one groups style, and OpenGL fits the other group''s style.

Btw, ToasterFace, your sig "HAVE SOME TOAST DARLING! OR I WILL BEAT YOU!" reminds me an aweful lot of the anime Lum Urusei Yatsura...

Share this post


Link to post
Share on other sites
quote:
Original post by ToasterFace
I was just curious what some programmers think about DirectX versus OpenGL, such as which system is actually easier to use?

HAVE SOME TOAST DARLING! OR I WILL BEAT YOU!


You should do a search in the forums for "DX vs OGL" the question has been answered 15 million times already. I''m really getting sick of seeing this question. Do a search, read and that''s it.



"And that''s the bottom line cause I said so!"

Cyberdrek
Headhunter Soft
A division of DLC Multimedia

Resist Windows XP''s Invasive Production Activation Technology!

"gitty up" -- Kramer

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!