Important: Please read the Qt Code of Conduct -

Looking for tutorial on making 3d games with Qt5.0.x ?

  • I hear that they've done some work in the area for 5.0 so I am researching ways to game a game with Qt and openGL. Where is a tutorial or examples I can look at for guidance?

  • Qt5 does have better OpenGL support than Qt4, but its not suitable "Standalone" for 3D Game Development, unless you plan on implementing alot of core tech on your own. If your looking for something in the area of building your own Unity3D then see below otherwise avoid Qt for 3D Game Development.

    Ogre3D "3D Graphics Engine Only"

    Integrate Ogre3D into a QML scene by rendering Ogre to a FBO.

    OgreBullet "3D Physics Engine"

    Hydrax and Skyx "Ocean and Sky Simulator"

    SmartBody "Character Animation Platform"

    OgreCrowd "Path-finding and Spatial Reasoning"

    QtQuick and QML "Scripting, Gui, Custom Ai, Mouse & Keyboard Input, ..."

    For 3D Audio there is "CAudio, FMOD or OpenAL"

    bq. *Simple Standalone Ogre3D Example
    // g++ main.cpp -o main pkg-config --libs --cflags OGRE OIS

    #include <Ogre.h>
    #include <OgreFrameListener.h>
    #include <iostream>

    using namespace Ogre;

    class MyFrameListener : public FrameListener {
    bool frameStarted (const FrameEvent &evt);
    bool frameEnded (const FrameEvent &evt);
    bool frameRenderingQueued (const FrameEvent &evt);

    bool MyFrameListener::frameStarted(const FrameEvent &evt) {
    std::cout << "Frame Started" << std::endl;
    return true;

    bool MyFrameListener::frameEnded(const FrameEvent &evt) {
    std::cout << "Frame Ended" << std::endl;
    return true;

    bool MyFrameListener::frameRenderingQueued(const FrameEvent &evt) {
    std::cout << "Frame Queued" << std::endl;
    return true;

    int main(void)
    // Create an instance of the OGRE Root Class
    Root* root = new Root;

    // Configures the application
    if (!root->restoreConfig())

    // Create a render window
    RenderWindow* window = root->initialise(true, "Tutorial 1");

    // Create a new scene manager.
    SceneManager* sceneManager = root->createSceneManager(ST_GENERIC);
    sceneManager->setAmbientLight(Ogre::ColourValue(0.0, 0.0, 0.0));

    // Create a new camera
    Camera* camera = sceneManager->createCamera("Camera");

    // Add our model to our resources and index it

    ResourceGroupManager::getSingleton().addResourceLocation("Media/packs/", "Zip");
    ResourceGroupManager::getSingleton().addResourceLocation("Media/models/", "FileSystem");

    Light* light1 = sceneManager->createLight("Light1");
    // Set Light Color
    light1->setDiffuseColour(1.0f, 1.0f, 1.0f);
    // Set Light Reflective Color
    light1->setSpecularColour(1.0f, 0.0f, 0.0f);
    // Set Light (Range, Brightness, Fade Speed, Rapid Fade Speed)
    light1->setAttenuation(10, 0.5, 0.045, 0.0);

    Entity* lightEnt = sceneManager->createEntity("LightEntity", "sphere.mesh");
    SceneNode* lightNode = sceneManager->createSceneNode("LightNode");
    lightNode->setScale(0.01f, 0.01f, 0.01f);
    lightNode->setPosition(0, 4, 10);


    // Using the camera create a viewport and set the background color to black
    Viewport* viewport = window->addViewport(camera);

    // Use the viewport to set the aspect ratio of the camera
    camera->setAspectRatio(Real(viewport->getActualWidth()) /

    // Create an instance of our model and add it to the scene
    Entity* ent = sceneManager->createEntity("Sinbad.mesh");
    SceneNode* entNode = sceneManager->createSceneNode("Character");

    // Create an instance of the MyFrameListener Class and add it to the root object
    MyFrameListener* myListener = new MyFrameListener();

    // Tell root to start rendering

    // Cleanup
    delete myListener;
    delete root;

    return 0;



    If your 3D Game requirements are simple then I can offer a simpler Qt solution but it will still be alot of work regardless. Overall in regards to Qt your best to just go with what I have laid out for you.

    If you use Qt4 then you might want to take a look at Blackberry Gameplay and this Qt example

Log in to reply