OpenGL or DirectX

Started by
18 comments, last by PatrickD 20 years, 11 months ago
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.
Advertisement
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).
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.
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.
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

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.
__________________________________________________________America seems to like crap because its what we make popular. - Goober King
WEhy? I made a cool 3D maze program before I knew that the -> operator was for pointers...

-~-The Cow of Darkness-~-
-~-The Cow of Darkness-~-
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]
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]
Ok thanks for the example I got it now

This topic is closed to new replies.

Advertisement