OpenGL or DirectX 9 coding?

I just came here to ask the same question that K.I.L.E.R asked :oops:

I think I'm going to try to learn both languages, but for DirectX9 I need a directX 9 card so it looks like I'll have to buy one.
 
I think youll enjoy learning both at the same time. This way youll see how they compare. I personally think OpenGl is the way to go. but try them both.

later,
 
Philibob said:
I think I'm going to try to learn both languages, but for DirectX9 I need a directX 9 card so it looks like I'll have to buy one.
You don't need DX9 card to do DX9... You'll need it if you want to do pixel shaders 2.0+ fast. Vertex shaders 2.0+ have good software fallback.
 
Basic knowledge should get you far. OpenGL would be easier since it's not object oriented.
 
Humus said:
Basic knowledge should get you far. OpenGL would be easier since it's not object oriented.

Hmm. To be honest, my graphics programming experience is limited to a crappy gouraud/phong object renderer in Java done in my CG courses, so I don't know if D3D or OpenGL is better.
But: Once one has grasped the concept of object oriented programming - isn't it much easier to program with, especcially when the programs grow larger?
Ever since it had made click in my head and I really understood OO programming (ok... this claim could be a bit exaggerated ;) ), procedural programming was getting more and more tedious for me.
 
Actually, I think both D3D and OpenGL are not object oriented. You don't want to do inheritance with D3D objects, generally. So the COM interfaces are just like handles, although I think D3D is more "modular" than OpenGL. Of course, for a low leve API it is not necessary to be object oriented.
 
pcchen said:
Actually, I think both D3D and OpenGL are not object oriented. You don't want to do inheritance with D3D objects, generally. So the COM interfaces are just like handles, although I think D3D is more "modular" than OpenGL. Of course, for a low leve API it is not necessary to be object oriented.

actually a low level 3D API is nice _not_ to be oo. but d3d's authors realized that only about dx6. i shudder at the recollection of light "objects", material "objects" viewport "objects", and various other "objects" which populated d3d prior to that time. i recall when porting our game engine from dx6 to dx7 the codebase almost halved in size and readability jumped reciprocally just from dropping those "objects" :idea:
 
Actually, I decided to not touch D3D6 (and previous D3Ds) just for the same reason :)
 
Go with GL. I have to use both for work, but for my own personal programs I always, always, always use OpenGL. It's so much cleaner and you can get a program up and running much quicker. You also don't have to worry about all sorts of interfaces changing on you when you go from one version to the next. D3D has come a long way (anyone remember execute buffers?! *cough*), but it still lags behind in user friendliness IMHO.
 
This is just my IMHO

If you new to this stuff and on Windows go with D3D.

The D3DX support library is very good (you can load just about any image format in 1 line). There is a wizard to create a complete framework, the debug DLL will catch alot of mistakes. You have effect files with HLSL which helps get a feel for what states, etc do.
Another bad thing for newcomers to OpenGL is the confusion IHV extensions can get you into.

If you more experienced, it doesn't really matter - both have good and bad points. At the actual hardware level they are largely the same, OpenGL has the advantage of IHV extension which is nice for real cutting edge research.
 
As a point on the C/ C++ debate. Bear in mind that most drivers are written in C for performance reasons, as C++ often has a lot of overhead associated with it.
For learning the ins and outs it really only matters which you find easier to understand.

CC
 
Captain Chickenpants said:
As a point on the C/ C++ debate. Bear in mind that most drivers are written in C for performance reasons, as C++ often has a lot of overhead associated with it.
For learning the ins and outs it really only matters which you find easier to understand.

CC

How many times does this have to be said! :rolleyes:

There is no performance overhead for C++, there are certain overheads for particular features of C++. C++ will often produce BETTER code than C (mainly due to stricter typing and clever use of templates). There is a cost for vtables, exceptions etc but if you don't use them you don't pay for them.

Even on PS2 which really hurts when using C++ features, you can use C++ alot of the time. Drivers use C (and ASM) for compatibility issues (drivers have often been around a long time and run on multiple OS's etc), expertise issues (driver writers are often not comfortable with C++) and the main reason is simply that it would gain them nothing. If you don't need OO why force it in? (there are lots of code, that doesn't need OO)
 
Sorry perhaps I should have said that their are overheads for some of the feaures in C++ that make things easier.
The problem is that unless you know what features do have a cost, and which ones don't then you can can inadvertantly use them.
A lot of the impression of slow C++ comes from when it was just a preprocessor ontop of a C compiler.

:)
 
I personally recommend OpenGL for starting out since it is much easier to get into and there are HEAPS of tutorials on the web. Also, alot of coders you bump into are OpenGL coders (not that I'm saying that there isn't alot of DirectX coders ;)).

Plus, once you understand OpenGL, there's alot of ARB extensions you can play around with (however, I advise staying away from vendor-specific extensions unless you are writing multiple code paths).
 
Actually there comes a point in every programmers life, where it's getting too complicated to go on without OOP.
Simple projects are easy to manage without it, but as complexity grows you will need it or you will drawn in the code.

That means that typically hobby programmers do NOT need OOP, as those programs are rarely that large and using OOP for them are just too cumbersome.

That's also why it's hard to teach what OOP is good for - unless you give a larger than half a year long project as an example. ;)

Note, that I talked about OOP, not C++.
C++ is just one of the most popular choice of OOP programming, because once you learnt C it's the easiest to transition to.

It is possible to write OO code in plain C (X Window System) but it's somewhat painful and theres less type safety
 
Back
Top