Archived

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

PatrickD

OpenGL or DirectX

Recommended Posts

If you are a beginner, I would strongly, strongly recommend using OpenGL. I have used them both, and OpenGL is much more intuitive and easier to get started with. I also find it a lot easier to play around with it, to change around settings and see what happens.

People make professional games using both packages, so there isn''t really a question of which is better for gaming. DirectX is probably more popular, but don''t forget that ID software uses OpenGL, and they are about as cutting-edge as you can get.

I''m sure that one package does a certain thing a little faster than the other. But the thing about programming is, a lousy design will *always* be slower than a good design, and it would take a professional-grade programmer to write a design good enough that the speed differences between OpenGL and DirectX would actually make a difference.

Share this post


Link to post
Share on other sites
eh, this post will be closed as quickly as a mod sees it hehe
some people get into heated debates over this

they both have basically the same functionality, just choose which one seems more appealing to you
i would go to nehe.gamedev.net and nexe.gamedev.net and look at the intro tutorial and maybe some other code snippets to see which style makes more sense to you

that is what was reccomended to me and i decided to go with opengl (right after i bought totwgpg using dx :\)

Share this post


Link to post
Share on other sites
I agree with andy_fish and think that you should go with the OpenGL API (application programming interface). However you will probably realize that you may want to use DirectX with OpenGL. The reason why is that OpenGL is only a grafix library there is no input/output, no sound, no networking for multi-player games. You could think of DirectX as just another one of Microsofts bundle software packs. DirectX is composed of: DirectDraw, Direct3D, DirectInput, DirectSound, DirectMusic, DirectPlay, DirectShow. when you use OpenGL you basically are replacing Direct3D. so the real question you should be asking yourself is Direct3D vs. OpenGL.

Share this post


Link to post
Share on other sites
http://www.gamedev.net/community/forums/showfaq.asp?forum_id=10

Read.

The code is the only difference.

What you really need to do is take a look at the first two or three NeHe tutorials, then take a look at a Direct3D 8 or 9 basic tutorial. Read through a few of each and decide which style you like more.

Share this post


Link to post
Share on other sites
There''s little to no difference between the two. They are the same speed and functionality. Most people will agree that D3d is hard to setup on dev-C++ as opposed to openGL, but not impossible.

Share this post


Link to post
Share on other sites
Correct me if I''m wrong but for what I''ve seen so far OpenGL seems to only support 3d graphics (even though it''s more organized than DirectX), and DirectX supports 3d graphics but and it also has different libraries for sound, 2d graphics, etc. Doesn''t OpenGl have any libraries that handle these things?

Share this post


Link to post
Share on other sites
opengl only does graphics. You can use external libraries for other things, such as fmod for audio and HawkNL for networking. Another good alternative is SDL, which handles windows as well as input, and is compatible with OpenGL.

As to which one, it doesn''t really matter. It''s not that hard to setup D3D, once you understand why you''re doing everything. I''ve used both, but currently I''m using D3D just because. The hardest part is understanding the underlying math behind all the 3D graphics. Once you understand that, you shouldn''t have trouble switching APIs.


''I never let schoolling get in the way of my education'' - Samuel Clemens, a.k.a. Mark Twain

Check out my raytracer at http://www.sourceforge.net/projects/simp-raytracer. Download it at http://simp-raytracer.sourceforge.net.

Share this post


Link to post
Share on other sites
Ok sorry about my post if I had read the faq http://www.gamedev.net/community/forums/showfaq.asp?forum_id=10
then there would have been no need to ask.

Share this post


Link to post
Share on other sites
Patrick:

You can use openGL with the non graphics DX APIs (DirectInput, DirectSound, etc.) The counterpart of openGL is Direct3d, not DX (though the original poster got it mixed up).

Share this post


Link to post
Share on other sites
Ok thanks for the help I went over both and since all of you agree there aren''t many differences between them I''ve decided to just use the one I feel most comfortable with which is OpenGl(I don''t really get the ''->'' style of DirectX), I feel the code is slightly easier to understand so I''ll try to learn OpenGl and over time when I feel confortable with it I''ll try to learn DirectX as well. Well anyway thanks again for all your help.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
You mention that you are using DevC++, so you will probably have a HELL of an easier time using OpenGL. Microsoft make DirectX you see and parts of it only work well with their compiler. Instead of using every single part of direct X, try using free or LGPL libraries for the individual parts. This has the added advantage that it is normally cross-platform.

Share this post


Link to post
Share on other sites
I would say that you use DirectX for input, sound, networking, and 2D graphics, and OpenGL for the 3D stuff. Its your choice, but this is what i would recommend.


Even though i almost never use OpenGL

Share this post


Link to post
Share on other sites
If you don''t understand the -> operator you''ll have some trouble making 3D games. I would suggest you stick with console-based (text) games until you have a firm grasp of the main features of the language.

Share this post


Link to post
Share on other sites
Hmm I don't really know exactly what '->' means (could someone please tell me what it is). I used it before for a lib I was using I didn't really know what it was for but it sure felt like I was just using a var from a struct or something. Well I not a complete newbie since I have programmed a few 2d games I'm just trying to learn 3d programming

[edited by - PatrickD on May 8, 2003 5:39:28 PM]

Share this post


Link to post
Share on other sites
The '->' operator is the same as the '.' operator except it works with pointers instead of instances. Say you have a struct:

typedef struct{
int a;
int b;
} foo;

Now, in your program, you have an instance of foo and a pointer to a foo struct.

main(){

foo mystruct;
foo *Pmystruct = new foo;
}

If you want to access the variable 'b' in mystruct, you use the '.' operator. If you want to access the variable 'b' in Pmystruct, you use the '->' operator. So this code:

mystruct.b = 5;
Pmystruct->b = 7;
printf("%d %d", mystruct.b, Pmystruct->b);

would print out
5 7



Likewise, you can use the operators in the same way to access functions in a struct or class. Basically, writing

var->x();

is the same as writing

*var.x();

[edited by - kdogg on May 8, 2003 6:47:00 PM]

Share this post


Link to post
Share on other sites