OpenGL Vs Monogame

Started by
13 comments, last by MyLastGamble 9 years, 5 months ago

So after much thought and a few posts on this site, as well as watching the MicrosoftVirtualAcademy course where they show you Construct 2, Gamemaker and Unity, I decided the best thing for me at this moment is to take a step back and just use a framework to start learning some game development so I can get as much C# experience as I can as I really enjoy the hands on experience.

Now, upon further research, it appears that OpenGL and Monogame are similar, and I think I read that Monogame actually uses OpenGL? Is there a benefit to one or the other?

I have acquired two books on this subject, one uses OpenGL called C# Game Programming for Serious Game Design and the other uses Monogame, called Learn 2D Game Development with C#. Which should I start out in as a beginner game developer, OpenGL or Monogame and is there a better resource out there? It appears both books cover things like game math and physics pretty well, but the one using OpenGL may be a little more detailed, I've just browsed both books and haven't looked into it fully.

Thanks for any help!

Advertisement

They are different APIs/Frameworks. Monogame is based on Mono, the crossplattform version of the .NET framework. It might contain some 2d graphics capability, but to utilize 3d graphics capability you would need one of the 3d graphics APIs. Microsofts perferred way would be DirectX for .NET, but with Mono being crossplattform, OpenGL is the way to go for 3d graphics (DirectX is not crossplattform).

So, you might use Monogame to start coding your game, and it might be sufficient for 2d games, but once you want 3d, it seems you need OpenGL too.

OpenGL is an API for sending commands to the GPU.

MonoGame is basically a simplistic game engine -- a collection of APIs that deal with graphics, audio, asset loading, user input, etc...
Inside MonoGame's graphics components, it will use OpenGL to send commands to the GPU in order to draw things.
(n.b. Different platforms have different APIs for controlling the GPU, so actually, it will use OpenGL, OpenGL|ES, D3D11 via SharpDX or GNM depending on which platform you're using it on!)

OpenGL deals with low-level commands, like sending texture data to GPU memory, binding shaders, drawing triangles and projecting vertices.
MonoGame deals with high-level commands, like load this 3D model from disc, draw this 3D model to the screen.

If you want to learn how to control a GPU, then use OpenGL.
If you want to learn how to make games, use MonoGame.

DirectX is not crossplattform

Just to be pedantic tongue.png
D3D runs on: 3 game consoles (5 on DC, 9 on Xb360, 11 on XbOne), Windows Phones, and PCs (via Windows/Linux+Wine).
OpenGL runs on: only PCs (via Windows/Mac/Linux) and it's sister GL|ES runs on Android/iOS.
There's also emulation layers to run GL|ES on PC via D3D, and to run D3D on Mac/Linux/PS4 via GL/GNM.
So it depends on how you define cross-platform - depending on your target platforms, either could be more cross-platform than the other laugh.png
Mobile/PC devs will get most reuse by writing a shared GL & GL|ES engine (with ifdef's around the differences) and porting to consoles as a 2ndary concern.
Console/PC devs will get most reuse by writing a shared D3D engine (and porting to Sony) and porting to Mac/Linux/mobile as a 2ndary concern.

So, you might use Monogame to start coding your game, and it might be sufficient for 2d games, but once you want 3d, it seems you need OpenGL too.

Monogame is a full implementation of XNA on Mono, and as such includes all the 3d graphics APIs that are in XNA. These are wrappers over OpenGL or DirectX (depending on the platform).

D3D runs on: 3 game consoles, Windows Phones, and PCs (via Windows/Linux+Wine).

OpenGL runs on: only PCs (via Windows/Mac/Linux).

Oh! I never realized that!

This "OpenGL ES" thingy that I see on 90+% of all mobile phones and tablets is actually based on D3D and not OpenGL, then? ;-)

*SCNR*

No. OpenGL ES runs 'natively' on mobiles. A very common way to emulate OpenGL ES on desktop systems is to use ANGLE (which offers an OpenGL ES interface but renders internally using DirectX). The advantage is that you need less platform-specific code if you work on both desktop. Additionally some OpenGL drivers on desktop are horribly bad (especially when you move towards older cards on extremely casual gamer systems) and using ANGLE can work around that problem.
(sgt_barnes was joking)

(sgt_barnes was joking)

The response was valid though....

A lot of folks say "cross-platform" when what they really mean is "Unix, Unix and more Unix".

One also needs to consider software platforms vs hardware platforms.

We can accept that OpenGL has better compatibility across software platforms (bearing in mind the caveats in Hodgman's post above).

But we must also accept that D3D has better compatibility across hardware platforms.

Direct3D has need of instancing, but we do not. We have plenty of glVertexAttrib calls.


Monogame is based on Mono, the crossplattform version of the .NET framework. It might contain some 2d graphics capability, but to utilize 3d graphics capability you would need one of the 3d graphics APIs. Microsofts perferred way would be DirectX for .NET, but with Mono being crossplattform, OpenGL is the way to go for 3d graphics

So if I want to make a 2D game, should I stick with Mono? Or can OpenGL be used for 2D graphics as well as 3D graphics?


MonoGame is basically a simplistic game engine -- a collection of APIs that deal with graphics, audio, asset loading, user input, etc...

I'm not sure I want to use even a simplistic game engine. I thought the game engine was the way for me to go, but after really looking into it I found them to be too much point and click and not enough actual coding. I really want to have full access to program user input, save states, collisions, etc on my own. While I know C# syntax I'm still trying to get use to all the useful classes and combining syntax to do certain things. I want as much hands on as possible when I make my games to give myself as much practice as possible, then in the future I can always move over to an engine of choice.

So if I want to make a 2D game, should I stick with Mono? Or can OpenGL be used for 2D graphics as well as 3D graphics?


OpenGL can do both 2D and 3D. I'm using OpenGL now and only focus on 2D

I'm not sure I want to use even a simplistic game engine. I thought the game engine was the way for me to go, but after really looking into it I found them to be too much point and click and not enough actual coding. I really want to have full access to program user input, save states, collisions, etc on my own. While I know C# syntax I'm still trying to get use to all the useful classes and combining syntax to do certain things. I want as much hands on as possible when I make my games to give myself as much practice as possible, then in the future I can always move over to an engine of choice.


Now this is based on my experiences

Originally when I started coding my games using "only code" I started with Microsoft's XNA which uses C#. And for me that was awesome! I wanted to do 2D games and it had everything I needed. Then when I heard Microsoft dropped XNA, I made the big leap to doing everything by myself from scratch. I ended up switching languages to C++ and moving to DirectX9, then to DirectX11, then to OpenGL for cross-platform support, then to OpenGL ES cause my friend was more comfortable do mobile stuff. And now I'm back at using OpenGL. So I have been across the spectrum of APIs and back. I have to admit doing things from scratch has definitely grown on me

I have noticed they all have one thing in common though. No matter what API (OpenGL or DirectX) you choose, when making things from scratch vs using a pre-made game engine/framework there is a huge learning curve. Don't get me wrong, I feel like I have become a better programmer and to me personally it has been rewarding. And I like the feeling that I get, that feeling of complete control. But you need to ask yourself the golden question:

Do you have the time and patience to make all the features you need and then all the features you want. When you know that those features are more than likely readily available in another game engine/framework? Plus the time and patience it takes to build and design your game on top of that?

Building a game in itself is a difficult task, which requires a starting point. And building this point from scratch is also a difficult task

This topic is closed to new replies.

Advertisement