Advertisement Jump to content
Sign in to follow this  
Chibuye Kunda

OpenGL using Qt's opengl bindings

This topic is 1821 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

Hi all

 

I have started writing a game recently, I have seen that Qt has defined many useful class ( QMatrix4x4 and all the OpenGL functions and many others ). Now my question is what will be the performance penalty of using Qt if any?

I noticed that some of the class have all constructors and functions defined as inline, so in order to prevent inlining is it worth inheriting to try keep size in check? any suggestions, comments and links will be welcome 

 

Thanks in advance

Share this post


Link to post
Share on other sites
Advertisement
I wouldn't consider using the helper classes like QMatrix4x4 for game development. Not for performance reasons, but because for serious game development too much is missing (starting with matrix of different sizes, non-rectangular matrices and so on). I'd rather use something like GLM from the start.

That said, using Qt to create and manage an OpenGL context is a different issue. Whether that makes sense will largely depend on the game you want to create. For example I would seriously consider it for a strategy game where UI complexity is a serious concern while maximizing my frame rate is not (QML/QtQuick is certainly an interesting beast to work with). On the other hand, for some shooter I would not even consider Qt.

The problem with Qt is probably less raw performance and more loss of control over the rendering loop.

Share this post


Link to post
Share on other sites

Don't try to prevent inlining unless you really know what you are doing. The library isn't designed to intentionally inline code that doesn't make sense to inline.

 

For Qt's math and similar functions, you'll almost certainly be fine on the performance front. If you ever find out you're not, it's not all that hard to replace the functionality you were using anyways.

 

For Qt's more generic tools, where performance will eventually kill you is state changes. If you're going to have simple scenes in your game, Qt will probably work well enough. If you're going to have complex scenes, Qt will be causing more state changes than you want behind the scenes.

 

Is there a reason you don't want to use an actual game engine or libraries specifically designed for games? When something is designed for games, it's going to optimize for animations, character movements, culling excess polygons, etc. When something is designed for general purpose use, it's going to optimize for a UI that probably only has a small portion changing, and probably with very simple changes at that.

 

Edit: BitMaster's point about just plain missing features essential for game development is probably even more important than performance. I haven't given much thought to this idea of using non-game tools for games, so there are probably other things I'm missing as well. Unless you can outweigh the concerns with significant benefits, I'd recommend just using actual game development tools for developing games.

Edited by richardurich

Share this post


Link to post
Share on other sites

Thanks for the replies guys, well for me it is more of a learning experience( Yes, I know it wont come anywhere near the pro Engines so why should I right ? ) I love to learn about things at a lower level( written a few device drivers and tried to see how small I could get my kernel before it stopped working properly ). I a very deep interest in games since doing a course on computer graphics last sem, I fully understand OpenGL internals and how the pipeline works, the math theory behind graphics etc. I just wanna find out about what libraries are generally used to write a respectable game( not using an engine ). 

 

@BitMaster thanks for the link, I will have a look at 

 

Thanks

Share this post


Link to post
Share on other sites

There are tons of libraries used for games, so you'd have to be a bit more specific. GLM is a header-only C++ library for vector/matrix math, and is really popular. SDL2 is a popular library to make more portable code. I could even go into individual image libraries like libPNG. If you're looking for rendering libraries, you might check out Ogre3D since it's an open source rendering engine. I'm not sure what you're looking for though. There are a lot of choices, and a ton are even open source under MIT or BSD licenses. If the license matters, you'll wind up using something like glLoadGen instead of the seemingly more popular GLEW.

 

There is absolutely nothing wrong with doing something odd as a learning experience, not even using Qt for a game. But the knowledge you can get from that is pretty limited if you're looking for gaming-specific knowledge since it's not really engineered to help develop games. If you're just starting, I'd recommend generic OpenGL tutorials since they teach you the fundamentals instead of telling you to use a game engine. If you've passed that point, I'd need to know your area of interest.

Share this post


Link to post
Share on other sites

If the license matters, you'll wind up using something like glLoadGen instead of the seemingly more popular GLEW.


Out of curiosity, what is the problem with GLEW's license? From what I could quickly gather the library is MIT or MIT-like licensed. That's already a very permissive license. I notice the scripts to generate the bindings are GPL but I cannot even think of a scenario right now where you would need to distribute those.

Share this post


Link to post
Share on other sites

Thanks for replies, licensing is a worry for future me...right now I want to gather all the necessary libs, I will look into the ones that were suggested. 

Share this post


Link to post
Share on other sites

 

If the license matters, you'll wind up using something like glLoadGen instead of the seemingly more popular GLEW.


Out of curiosity, what is the problem with GLEW's license? From what I could quickly gather the library is MIT or MIT-like licensed. That's already a very permissive license. I notice the scripts to generate the bindings are GPL but I cannot even think of a scenario right now where you would need to distribute those.

 

Some employers have a strict policy against GPL licenses, and how obvious it seems to you that scripts generating code are different from the code is unfortunately not as obvious to lawyers.

 

I was not trying to scare anyone away from GLEW, and I admit my wording was somewhat misleading. The OP is probably working independently, and likely has no reason to dislike GLEW's licensing terms. GLEW is popular for good reason.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!