Jump to content
  • Advertisement
Sign in to follow this  
Kees Waagmeester

OpenGL Engine question

This topic is 4974 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Should a game engine support both OpenGL and DirectX? If it's 'better' to support them both, then why? OpenGL is cross platform, why not only use that one? Thanks in advance, Kees

Share this post


Link to post
Share on other sites
Advertisement
Some features are available on one platform or the other at different times. For example, HLSL was available a for a while before GLSL was introduced. Also, not all programmers know both api's, so it might extend your possible user base.

Share this post


Link to post
Share on other sites
Quote:
Original post by Kees Waagmeester
OpenGL is cross platform, why not only use that one?


I can't speak for all people, but OGL is a pain to use compared to D3D when you start doing anything remotely serious.

As for supporting both OGL and D3D, it's something to keep in mind when desiging, maybe abstract your renderer, but it's not terribly important in this day and age. Hell, neither HL2 nor Doom 3 bothered.

Share this post


Link to post
Share on other sites
Quote:
Original post by Promit
I can't speak for all people, but OGL is a pain to use compared to D3D when you start doing anything remotely serious.


why?

Share this post


Link to post
Share on other sites
If you're designing your engine to be competitive with other free engines like OGRE, then *maybe* supporting both is a good idea...

Otherwise, IMO there's really no point in supporting both. Then the decision boils down to, cross platform or not? If cross platform, then OpenGL, else DirectX. Keep it simple :)

Share this post


Link to post
Share on other sites
OpenGL is available on platforms other than Windows; DirectX is not.

DirectX has better hardware compatibility among off-brand Windows hardware -- which has something like 20% of the market. If you want to run on hardware that's not from NVIDIA, ATI or Intel, you're likely better off with DirectX on Windows.

Thus, you need both if you want maximal coverage.

Share this post


Link to post
Share on other sites
Quote:
Original post by _the_phantom_
Quote:
Original post by Promit
I can't speak for all people, but OGL is a pain to use compared to D3D when you start doing anything remotely serious.


why?


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.

In addition, the OpenGL API is starting to fall apart. It's kind of hit the edge of its scalability, so things are now getting progressively more annoying. You'll want a example, of course:

glActiveTexture( GL_TEXTURE0 );
glEnable( GL_TEXTURE_2D );
glBindTexture( GL_TEXTURE_2D, TexIndex );
glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE );
glTexEnvi( GL_TEXTURE_ENV, GL_SOURCE0_RGB, GL_PRIMARY_COLOR );
glTexEnvi( GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_COLOR );
glTexEnvi( GL_TEXTURE_ENV, GL_SOURCE1_RGB, GL_TEXTURE );
glTexEnvi( GL_TEXTURE_ENV, GL_OPERAND1_RGB, GL_SRC_COLOR );
glTexEnvi( GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_DOT3_RGB );

glActiveTexture( GL_TEXTURE1 );
glEnable( GL_TEXTURE_2D );
glBindTexture( GL_TEXTURE_2D, TexIndex2 );
glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE );
glTexEnvi( GL_TEXTURE_ENV, GL_SOURCE0_RGB, GL_CURRENT );
glTexEnvi( GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_COLOR );
glTexEnvi( GL_TEXTURE_ENV, GL_SOURCE1_RGB, GL_TEXTURE );
glTexEnvi( GL_TEXTURE_ENV, GL_OPERAND1_RGB, GL_SRC_COLOR );
glTexEnvi( GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_MODULATE );



All that just to set up the stages for two textures. You can do it in about 1/3 as many lines in D3D. There's so many dumb things here. The need to enable GL_TEXTURE_2D. The constant repetition of GL_TEXTURE_ENV for a function that is called glTexEnv. The inability to modify more than one portion of a 6 argument expression at a time. The need to set an active texture, instead of specifying the affected stage for each call. The need to explicitly enable GL_ARB_texture_env_combine. It's just a royal pain.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.


Do you have any justification for your argument? Because I assume DirectX doesn't actually smell. Lots of people use DirectX and are happy with it, so throwing that comment in isn't very helpful for someone unfamiliar with DirectX :)

In my experience, it's really nice to abstract the rendering so you can support both OpenGL and DirectX, but assuming you're making a game in your spare time, there's a lot to be said for just picking one and getting the game done. It's cool to have a decent engine design, but what good's an engine design if you never finish anything?

Share this post


Link to post
Share on other sites

This topic is 4974 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Guest
This topic is now closed to further replies.
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!