What to use for an OpenGL-based game engine.

Started by
7 comments, last by LightOfAnima 9 years, 10 months ago

Hello! So, I have spent quite some time coding a 3D game project for fun and learning, and have decided that I desire to create a game engine mainly for experience, perhaps to be released open-source if I get to finish it. I am aware that it is a vast topic, but am currently a college student and have a desire to learn. So please don't just post a link to that "Build games not game engine" article, as I saw people do happy.png

Anyway, yes. I figured that while I'm writing a game, I might as well try to write an interface to create levels, help with importing assets, etc. My first idea was to use a GUI system to create this interface essentially _inside_ the render window, but frankly, that's more of a hack. What I am truly looking for is to have a window, containing toolbars, etc., and a render window in the centre, akin to what can be found in common game engines such as Unity and the Cryengine 3 (the latter of which being my inspiration). Is there any cross platform way to do this? I have attempted to use QT, but it seems that it is not exactly suited for high performance realtime simulations. Naturally I could always write this interface using the API of a particular operating system, but my aim is to keep it as cross-platform as possible without the need to change much in order to move systems (my main targets truly are Windows and Linux).

So my question truly is, is there any way to do this using a cross platform tool that is suitable for game development? Thanks! ^_^

Advertisement

I would give QT a shot. Can't even imagine what can be wrong with using it as GUI component of your game. Don't you just pass hwnd down to OpenGL maw?

Well, I did try QT... I found myself unable to set up my own widget with a custom game loop and GL context :/ I spent days trying it with no success. I admit to be slightly inexperienced yet with OpenGL ^^ And hwnd... Isn't that a Windows handle? Doesn't sounds very cross platform o.o

Just to clarify, I do not mean a GUI system. I mean an external set of panels that serve as a game engine interface, with the actual OpenGL window being on a panel inside the application.

Try harder, because QT is exactly what you are looking for.

I think Cryengine uses MFC while Unity and UE4 use custom rendered GUI widgets.. but I might be wrong about these.

Another option would be to forget about cross platform (for an editor, it isn't needed at all) and use C#/WinForm exposing your engine using CLI C++... I currently use this and it quite simple to implement.

Stefano Casillo
TWITTER: [twitter]KunosStefano[/twitter]
AssettoCorsa - netKar PRO - Kunos Simulazioni

Unity and the Cryengine 3


These both wrote their own UI toolkits, for what it's worth. This is partly because there just isn't a really good cross-platform UI toolkit, especially considering these engines have to support OpenGL (various versions, plus OpenGL|ES), Direct3D 9-11, and the consoles' proprietary APIs. Even many PC/mobile-centric applications like Chrome, Firefox, OpenOffice, and so on write their own UI toolkits from scratch.

There are a bazillion UI libraries out there to choose from. Most are pretty meh when it comes to games, but they're there. A popular trend these days is to write your UI in HTML5/JavaScript and use a library like Chromium Embedded Framework, Awesomium, or Coherent (all basically just Chrome with a different set of tweaks and wrapper APIs).

Sean Middleditch – Game Systems Engineer – Join my team!

Thank you guys. I think I'll just write the system in my comparability layer then using the OS API :) I have merely hoped that a good solution exists that I may have overlooked.
And regarding QT, from what I read many people seem to agree that it is simply not suitable for games. Again, could be totally wrong.
I personally use wxWidgets for tooling (since I never liked the way that Qt advocates using non standard C++).
It is portable to pretty much any OS people run productivity software on.

The exact widget I use is called wxGLCanvas.

You can read more about it and it's usage here: http://wiki.wxwidgets.org/WxGLCanvas

Most people's gripe with it is that much of the old documentation talks about things like DECLARE_EVENT_TABLE() because it used to use this system back when MFC was "cool", however this is very out of date and you should use connect() instead. Have a read of: http://wiki.wxwidgets.org/Example_Of_Using_Connect_For_Events
Not many developers know this unless they have actually used wxWidgets before so unfortunately this misinformation still spreads.

For the games themselves, I really suggest grabbing a rendering context from some library (Glut will do on desktop, GLSurfaceView will do on Android) and then create your own GUI widgets in OpenGL.
http://tinyurl.com/shewonyay - Thanks so much for those who voted on my GF's Competition Cosplay Entry for Cosplayzine. She won! I owe you all beers :)

Mutiny - Open-source C++ Unity re-implementation.
Defile of Eden 2 - FreeBSD and OpenBSD binaries of our latest game.


I think I'll just write the system in my comparability layer then using the OS API

Hello, fellow engine creator :)

I would strongly suggest you to stick to either Qt, or to something like wxWidgets or GTK. Don't listen to those, who saying that 'everything is garbage, write your own OS/GPU API/ UI system', they're only partially right :) Or you will end up creating your own GUI library, learning OS-level API, and will not learn about game engine programming :) Anyways...

I have some experience with Qt within application involving graphics and realtime data processing (not 3D though, but hey, it's realtime with threading :)) ) and I can say that it has everything you need: a set of widgets of all sorts, threading, UI editor, IDE ( if you prefer ) and even a special widget to which you can give your OpenGL rendering stuff.

Most likely I'm going to stick to Qt with my own OpenGL-driven engine project :)

And one more advice - it's better for you to learn first the hard part - OpenGL, GLSL, script language integration, software architecture and game engine creation process itself. In my opinion it's preferable over first attempts to create your toolset, level editor or whatever.

How it was mentioned above - grab some windowing library ( SDL2/GLFW ) and go on trying :) You can even create switchable system with various windowing backends.

Anyways, good luck, will wait for amazing screenshots from you :)

P.S.

Try to avoid OS-level API, if you want to keep it cross-platform. Better - not use them at all, or pack 'em carefully with macros invocations or configurable build system.

wxwidgets seems to be exactly what I was l was looking for! Thank you... I have spent the entire day trying to make it work (I fail at this), and will try it filly when that happens!

Sysrank, I will consider what you said about keeping the level editor until last :) My main reason for wanting to create an engine-style interface is so that it could help me position objects around and everything and tweak variables without having to add redundant code or recompile ^_^ And as for screenshots... Might take a while, but I'll try to get something impressive working XD One of my main interests may be high quality volumetric cloud rendering, which seems to be a massive topic, but I don't mind.

Anywho, thank you ^_^ I am shocked that the internet did not lead me to these wxwidgets/GTK. I think it did, but in my haste I might have dismissed it as a GUI library by accident :/ Thanks again!

This topic is closed to new replies.

Advertisement