Engine question

Started by
23 comments, last by superpig 19 years, 3 months ago
I currently spent the last two months learnign both Direct3D and OpenGL.

I had never touched them before.

With each I made a small renderer and a game prototype.

As far as each go IMO, they are equally capabable. But OpenGL is UGLY (im talking about the language, and the source you produce). It just begs for you to write wrappers for the whole thing.

OpenGL is clumsy and even though it has extensive documentation its not always easy to find.

DirectX is pretty (just as pretty as C++) and if you can read you can make it work.

As far as what to put in an engine. To me it seems like that is determined by what sort of developer you want to be.

If you are an indie developer then go cross-platform and do OpenGL. You'll probably find a better market on Mac and Linux desktops, as they are not saturated with games.

IF you want to make huge commercial games, then I'd say go with DirectX. Possibly for the single reason that huge games are complex, and you can cut the complexity level of design and implementation if you go ahead and cut out supporting multiple platforms and many driver configs. Sadly the easiest way to do that would be stick with MS and DirectX.

As well Direct3d and OpenGl comparision is one thing. But there is virtually nothing to compare to DirectX (direct3d, DirectSound/Music, DirectInput, DirectPlay).

OpenAL seemed great. I messed around with SDL but didnt like it too much, leaving me wishing for DirectInput. I'm not sure what a good cross-platform input library is that supports, any joystick, keyboard layout etc..



Just my 2 cents...
Advertisement
Quote:Original post by hplus0603
Thus, you need both if you want maximal coverage.


So if I understand it correctly the reason to implement both is hardware coverage? Or are there other reasons?
Well, I've never liked DirectX... I don't know.
I found that it produced clumpsy code...
And I had the greatest problems trying to compile a basic example.


But the API that you want to use depends mostly on your target platform and your personal favourite.
Quote:Original post by HAM
OpenGL is clumsy and even though it has extensive documentation its not always easy to find.

DirectX is pretty (just as pretty as C++) and if you can read you can make it work


Really? I'm a C++ man and I find OpenGL far more "pretty". Though, granted I haven't really looked at DX since version 7/8.

Quote:
All that just to set up the stages for two textures.

One thing I like about OpenGL, is that it seems to be closer to the metal as it were. Talking DX7 level of things now, D3D's texture stages have no relevance on how things actually work.

Quote:
Mainly the lack of anything comparable to D3DX. Rewriting the D3DX math routines alone is a pain. Then you have to do normal and tangent computations yourself, as well as pulling in libraries like Cg if you want to have a reasonable material/shader system without writing long, long custom code.


This actually doesn't bother me, which is strange. I've written my own math routines without much problem ( it's not like it's hard in the first place ). If you don't like Cg, there's always GLSL. If you mean something like the .fx format... Then yeah it is quite a hassle to write your own ( I did - took a while ).

One thing I actually like about OpenGL is the extension system, I think it's just grown on me, or I've just become used to it.
If at first you don't succeed, redefine success.
One thing not mentioned so far is the attrictivness (sp?) to employers of being able to use, and showing your use, of more than one API. The majority of game studios that cover more than one platform will use, to a varying degree, their own custom built API.

By showing an employer you are not trapped in one API, and can produce the same outcome with what ever tools you are given is a real plus.

But, and heres my two pence, if your just doing this as a hobby, stick with one for now, you can always abstract the rendering code out later if you want to support more than one API. Want to work on Linux, use OpenGL, windows only, up to you.

I personally have used both, I prefer DirectX simply because I taught myself DX, whereas we had a crappy lecturer at university teaching us OpenGL, and i think that tainted me a bit...

Hope that helps a little
Spree
It's always cool to see the heated discussion of which is better DirectX or OpenGL.
But the problem is that it is a question of personal taste, and so the discussion is endless.

What I want to discuss is: Use DirectX OR OpenGL in your engine (implement just ONE) or use DirectX AND OpenGL in your engine (implement BOTH).
And how to rectify the (huge) amount of extra work of implementing them both.
It could possibly be done through a plugin system.
Like you have 2 DDL's (I assume you are making this for the Windows platform, since DirectX is native to Windows). Both have the same routines you can call.

Like Vertex(), Begin(), End(), etc, etc (I know, I know OpenGL syntax, just the lack of knowledge of the DX syntax)...

So you dynamicly link the API you want to use through LoadLibrary function and use the object ot call those functions.

Then those functions do (say for the OpenGL.dll):
void Vertex(...)
{
glVertex3d(...);
}
etc, etc...

Then possibly it's possible to extend your renderer with new API's (I'm 99.9% sure I'm going to learn OpenRT when I can).
I am basically doing what mldaalder suggested.

I have a CRenderer interface that describes the basic functionality of a renderer. Then I use class inheritance to buidl a DX renderer and an OpenGL renderer.

I use DLL's so that I can in the future switch between renderers and have everything work. At the moment I am working on the DX side of things since that is what I am most familiar with and will then move to openGL later.

To make this all work though I had to basically extract out the abstract ideas about rendering such as texture stages and different operations that could be applied to them so that the renderers can massage the information into the format they like.
Quote:Original post by JD
The whole DX stinks. Thank god for alternatives. That about sums up the whole DX programming experience for you. I have no idea what I saw in DX in the first place. If you can please use opengl/openal to save yourself some sanity. How can a company that wrote vc6 which I love turn around and produce a dud that DX is? It's like the two aren't even from the same company. Really strange.

If over 90% of the industry didn't use DirectX and the API was so well designed I might actually agree with you on that idiotic point :) It is also funny you say that as in the latest versions DX has borrowed a lot of ideas and design issues from GL.

Both GL and DX have their place, the only bad point with GL that I have noticed over the years is that games that have been released that aren't by ID users have a harder time playing, etc. A lot of users don't update their drivers every week or two, and I noticed a lot more support issues with GL games versus DX when it came down to drivers.

Obviously that really has nothing to do with GL as an API, but with driver support from manufacturers which I myself count as just as important.
Quote:Original post by python_regious
Quote:
All that just to set up the stages for two textures.

One thing I like about OpenGL, is that it seems to be closer to the metal as it were. Talking DX7 level of things now, D3D's texture stages have no relevance on how things actually work.


I haven't used DX7, but in DX8 and DX9, the texture stages work identically to OpenGL...but the actual syntax is cleaner, less function calls, etc.
SlimDX | Ventspace Blog | Twitter | Diverse teams make better games. I am currently hiring capable C++ engine developers in Baltimore, MD.

This topic is closed to new replies.

Advertisement