Sign in to follow this  
Friktion

Directx or Opengl for my Game Engine

Recommended Posts

Hello im going to create a game engine. It will be coded in c++ in a windows operating system. well my question is if i would create a game what is recommended Opengl or Directx i know that opengl is cross-platform and that directx is only for windows and xbox no need to tell me that. just the pros and cons of using it to render a game environment. and please dont link me to those comparison sites since they dont say that much about how they work in games. and when searching in youtube the most game engines there are in opengl, i have also once programmed using it but seems that its not recommended for games anymore. sorry for writing so much but any idea what would be good ? marry x-mas and a happy new year.

Share this post


Link to post
Share on other sites
Well, since you're target platform is just windows, I'd try doing a small sample project in both DirectX and OpenGL and see what you prefer. Really, at this point given what you've said, it comes down to personal preference and which you'd rather learn at this moment. Granted, it's good to know both, but you have to start somewhere.

Share this post


Link to post
Share on other sites
I would advise against writing your own game engine/graphics engine if your trying to make a game.

Game engines usually support both Direct3D and OpenGL rendering.

If you want to do it for the background and learning experience basically you have to try both of them and see what one you like better. I would recommend Direct3D as it is a lot easier IMO. OpenGL is good and it's what I started with years back. Learning from NeHe tutorials. Direct3D is more object-oriented and OpenGL is not so much.

The final product will look pretty much the same.

If you want to get programming games there are already great options for graphics engines that support both Direct3D and OpenGL such as Ogre3D.

There's also Irrlicht Engine and Crystal Space 3D to try out.

Share this post


Link to post
Share on other sites
Thanks everybod.
im usually the one that wnats to create things my own, i started with ausing something similar to ogre but got tired and decided to code everything myself so i started with opengl and kinda like it but i cant say anything since i havent tried directx yet so i will do that.
thanks for helping me.

Share this post


Link to post
Share on other sites
Quote:
Original post by eFoDay...snip...


^^^ What he said!

That's not to say that you shouldn't write your own engine, but if you do so, it needs to be on your own time and for the sole purpose of learning how to write game engines. Don't try to make one for your game as there are so many high quality, free and cross-platform engines available. You'll get so bogged down in the engine creation that you'll lose sight of your game and get discouraged. Been there, done that. It simply is no longer necessary to write your own, again, unless you are doing so for your own education.

Share this post


Link to post
Share on other sites
FYI

If your goal is to make it work on multiple PCs, I advise going for Direct3D. OpenGL is not good as it causes problems (not able to run your game at all) on a lot of ATi cards out there. ATi's OpenGL API implementation is not forgiving.

source: experience.

Share this post


Link to post
Share on other sites
Directx is supported much more on hardware, for example you can be glad if newest GPUs support OGL 2.1, plus, directx will run well on older GPU drivers unlike Opengl. If you want your games run on as many PC as possible and as fast as possible, paradox given, use directx.

Share this post


Link to post
Share on other sites
Quote:
Original post by JohnnyCode
Directx is supported much more on hardware, for example you can be glad if newest GPUs support OGL 2.1, plus, directx will run well on older GPU drivers unlike Opengl. If you want your games run on as many PC as possible and as fast as possible, paradox given, use directx.


Huh? GL 2.x has been standard across the board for several years now and the newer GPU's fully support 3.x. There are issues with ATi's support of OpenGL, but that only applies to ATi and even then, OpenGL still runs well. OpenGL is quite robust and very well supported. The problem with ATi is that they work so closely with Microsoft on DirectX support that their OpenGL drivers are lacking and they are slow to update them. This is a quality control issue for ATi, not OpenGL.

Don't get me wrong, if you are developing a game for Windows and Windows alone, go with DirectX. Or simplify your life and use Ogre3D...

Share this post


Link to post
Share on other sites
I may not be the best one to comment on this as I make games much more "niche-marketed" but I am fond of creating my own engine. This is because 1) you learn much more 2) you can tailor to your specific liking and 3) (most importantly) if there is a bug in the code, you can fix it yourself and track it easier than if using someone else's engine and code.

However, if you desire short development time and the most effecient results then do as the other fellow suggested and use a preexisting engine.

Share this post


Link to post
Share on other sites
Hello again, sorry for bumping this thread.
But i have a good reason for it.
The thing is that i choosed Directx and i have been learning it for a while now but while googling some Directx stuff i stumbled on this article Why you should use OpenGL and not DirectX

And now im not really sure what to use anymore =/

Thanks.

Share this post


Link to post
Share on other sites
Write an abstraction layer for your graphics device and implement concrete devices for both OpenGL and DirectX. There, now choosing an API isn't a problem anymore.

Share this post


Link to post
Share on other sites
My ATI 4850 seems to run OpenGL 3.x fine, up to 3.1.

The thing is that unlike Nvidia the ATI driver will not automatically give the highest context available so you have to make sure to request the correct context version. Also it will do a weird fallback to 1.3 (I think it was that) if it fails to get the requested context version, which is admittedly strange and rather annoying. Note I have only used GLX for my 3.x context creation.

Share this post


Link to post
Share on other sites
Quote:
Original post by Friktion
Why you should use OpenGL and not DirectX
The interesting thing there is the writer didn't draw attention to that fact that even John Carmack decided not to use OpenGL for the PS3 but chose CG instead. And the author neglected to bash Sony for *their* decision to not just use OpenGL for their gaming platform. He also neglected to talk about the fiasco with OpenGL 3.0. Things looked pretty hairy with it for quite awhile and you can hardly blame Microsoft for that. There were some good points in that article but it mostly felt like a hatchet job to me.

Share this post


Link to post
Share on other sites
Quote:
Original post by Scourage
Why not just use Ogre3d for your rendering needs.
Good advice ;) As a graphics programmer, I'd highly recommend using a wrapper/graphics-engine rather than dealing with these bare-bones APIs! Personally, I use Horde3d for my non-work projects (and use proprietary wrappers at work).
Quote:
Original post by nobodynews
The interesting thing there is the writer didn't draw attention to that fact that even John Carmack decided not to use OpenGL for the PS3 but chose CG instead.
That doesn't make sense - CG is an implementation of the HLSL shading language whereas GL is a graphics API. You can't choose a shading language instead of a graphics API!

In that article, the writer says: "As John Carmack said when asked if Rage was a DirectX game, "It’s still OpenGL, although we obviously use ... CG on the PS3.""
Seeing as the PS3 only offers one choice of shader language (i.e. CG), I'd take this statement to mean that while they *are* using GL on the PS3, they obviously have to write their shaders in CG (instead of the traditional GLSL).
You can also use GL+CG on PC if you happen to like HLSL syntax more than GLSL syntax...

[Edited by - Hodgman on January 10, 2010 9:52:58 PM]

Share this post


Link to post
Share on other sites
Quote:
Original post by Friktion
Hello again, sorry for bumping this thread.
But i have a good reason for it.
The thing is that i choosed Directx and i have been learning it for a while now but while googling some Directx stuff i stumbled on this article Why you should use OpenGL and not DirectX

And now im not really sure what to use anymore =/

Thanks.


Ugh... this is why people shouldn't be allowed to write things.

That 'article' is complete garbage and generally dumb. The part on 'power' is complete rubbish and basically untrue (GL lacks DX11 features, some DX10(.1) features, the tessellation mentioned ISNT the same as D3D11's and the spec only went public last year and not 3 years ago) and the rest is a thinly covered MS bash.

Share this post


Link to post
Share on other sites
Quote:
Original post by AndreiVictor
FYI

If your goal is to make it work on multiple PCs, I advise going for Direct3D. OpenGL is not good as it causes problems (not able to run your game at all) on a lot of ATi cards out there. ATi's OpenGL API implementation is not forgiving.

source: experience.


More recent Ati OpenGL support is very good, it is stricter in terms of following glsl specification, Nvidia's method of compiling GLSL via CG compiler is very loose, and will allow you do lots of things in your shaders GLSL does not necesarily support. one example is the use of CG syntax...which is obviosuly not acceptable..

So yes if your working on an Nvidia you will have a lot of potential problems on ATI cards, but this is because you have not written strict GLSL which any shaders you write and compile on ATI cards will pretty much be garunteed to work on Nvidia cards.

I wouldn't say "ATi's OpenGL API implementation is not forgiving" just because it striclty follows OpenGL/GLSL specs where as Nvidia is loose..

Share this post


Link to post
Share on other sites
Thanks everybody.
Im still not that sure what to use but please dont tell me to use Ogre3d my goal in this project is to create an engine and not an game i do have some ideas on what to do for the game but that is once im able to do the basic stuff.
I have done this before but with python and it was great but i decided to learn c++.
so i do have some basic experience in opengl and i like it but since i havent used Direct3d i cannot say that i like opengl more.

Share this post


Link to post
Share on other sites
Quote:
Original post by Friktion
Thanks everybody.
Im still not that sure what to use but please dont tell me to use Ogre3d my goal in this project is to create an engine and not an game i do have some ideas on what to do for the game but that is once im able to do the basic stuff.
I have done this before but with python and it was great but i decided to learn c++.
so i do have some basic experience in opengl and i like it but since i havent used Direct3d i cannot say that i like opengl more.


Trying to develop an engine without a game, when you have zero experiance with either, is likely to end up with a collection of code which when used in the real world isn't really any use.

You would learn just as much, if not more, by producing a game up front, learning from it and then pulling reusable code out of the game to form a collection of code you can use for another game and so on.

As for OpenGL vs D3D, if you already know some OpenGL you might well be better off staying with it as it gives you a base to work from.

Either way, I strongly recommend against going out and trying to make an engine blind.

Share this post


Link to post
Share on other sites
Quote:
Original post by Friktion
Why you should use OpenGL and not DirectX


Amongst other things, that article uses old arguments from fricken 1997, equates OpenGL with OpenGL ES, doesn't touch upon the fact that building games that are portable to things like Wii and iPhone will require multiple render paths *anyways*... amongst other stupid arguments. As jpetrie pointed out, the article is dumb, and the guy who wrote it is ill-informed and obviously biased.

Assuming you don't care about porting your game to Mac or Linux, the decision between OpenGL and DirectX boils down to preference. If you do care about Mac and Linux, then go OpenGL. If you're thinking of porting to non-PC platforms like iPhone, then you'll probably want to aim for OpenGL just to smooth the transition, but you'll still have to do work to port it.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this