Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Looking for tutorial on making 3d games with Qt5.0.x ?
Forum Update on Monday, May 27th 2025

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

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 4.7k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    pwnstar23
    wrote on last edited by
    #1

    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?

    1 Reply Last reply
    0
    • Z Offline
      Z Offline
      zester
      wrote on last edited by
      #2

      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"
      http://www.ogre3d.org/

      Integrate Ogre3D into a QML scene by rendering Ogre to a FBO.
      https://github.com/advancingu/QmlOgre

      OgreBullet "3D Physics Engine"
      http://www.ogre3d.org/tikiwiki/tiki-index.php?page=OgreBullet
      https://bitbucket.org/alexeyknyshev/ogrebullet

      Hydrax and Skyx "Ocean and Sky Simulator"
      http://www.paradise-studios.net/?page_id=270

      SmartBody "Character Animation Platform"
      http://smartbody.ict.usc.edu/

      OgreCrowd "Path-finding and Spatial Reasoning"
      https://github.com/duststorm/OgreCrowd

      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 {
      public:
      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())
      root->showConfigDialog();
      root->saveConfig();

      // 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");
      camera->setPosition(Ogre::Vector3(0,0,15));
      camera->lookAt(Ogre::Vector3(0,0,0));
      camera->setNearClipDistance(5);

      // Add our model to our resources and index it
      

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

      //
      Light* light1 = sceneManager->createLight("Light1");
      light1->setType(Ogre::Light::LT_POINT);
      // 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->attachObject(lightEnt);
      lightNode->attachObject(light1);
      lightNode->setScale(0.01f, 0.01f, 0.01f);
      lightNode->setPosition(0, 4, 10);

      sceneManager->getRootSceneNode()->addChild(lightNode);

      // Using the camera create a viewport and set the background color to black
      Viewport* viewport = window->addViewport(camera);
      viewport->setBackgroundColour(Ogre::ColourValue(0.0,0.0,0.0));

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

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

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

      // Tell root to start rendering
      root->startRendering();

      // 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 http://gameplay3d.org/ and this Qt example
      http://www.gameplay3d.org/forums/viewtopic.php?f=5&t=564&sid=330188c8aa2b4f19641079e0e4466101

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved