Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Game Development
  4. Ogre's viewport wont update in real time
Qt 6.11 is out! See what's new in the release blog

Ogre's viewport wont update in real time

Scheduled Pinned Locked Moved Game Development
12 Posts 4 Posters 11.0k Views 1 Watching
  • 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
    ProgrammerAtHeart3344
    wrote on last edited by
    #3

    I actually tried that and the program was unresponsive....

    1 Reply Last reply
    0
    • T Offline
      T Offline
      Taamalus
      wrote on last edited by
      #4

      Aha. Then I've have to pass. I just getting into QT as a game engine. I did not see your second control QPaintEngine. One of the QT team should be able to respond. Or delete this thread, and rephrase the question using only QT controls.
      Another potential issue I see is that there is no 'visible statement' in your code snippet you posted, to link to QT's OpenGL support; <QGLWidget> . In other words, QT does not release ownership to Ogre renderer because it may not be able to read it fully.

      This is what the world really needs, a debugger that caters to gamers. :)

      ... time waits for no one. - Henry

      1 Reply Last reply
      0
      • P Offline
        P Offline
        ProgrammerAtHeart3344
        wrote on last edited by
        #5

        well, i asked on the Ogre forum and managed to get an answer, i had to call update() in paintEvent and it worked, the mesh still doesn't rotate smoothly though but it's a start

        1 Reply Last reply
        0
        • T Offline
          T Offline
          Taamalus
          wrote on last edited by
          #6

          Thanks. I just wrote that down! Yes, ironic, me trying to help and getting answers instead. :D

          ... time waits for no one. - Henry

          1 Reply Last reply
          0
          • P Offline
            P Offline
            ProgrammerAtHeart3344
            wrote on last edited by
            #7

            well, that's how it is.......there's still a lot of work to do with it and i've found my self creating multiple windows and scene managers for each part, like a mat_mgr for material editing, blah blah

            1 Reply Last reply
            0
            • ? This user is from outside of this forum
              ? This user is from outside of this forum
              Guest
              wrote on last edited by
              #8

              [quote author="Taamalus" date="1289060400"].... I just getting into QT as a game engine. I did not see your second control QPaintEngine. One of the QT team should be able to respond. Or delete this thread, and rephrase the question using only QT controls.
              Another potential issue I see is that there is no 'visible statement' in your code snippet you posted, to link to QT's OpenGL support; <QGLWidget> . In other words, QT does not release ownership to Ogre renderer because it may not be able to read it fully.[/quote]

              Taamalus, it should be Qt, QT is Quick Time :)

              1 Reply Last reply
              0
              • H Offline
                H Offline
                hugox
                wrote on last edited by
                #9

                Hi,

                My name is hugo and i'm working on a adaptation of ogre3D engine
                using qt5 :
                http://advancingusability.wordpress.com/2013/03/30/how-to-integrate-ogre3d-into-a-qt5-qml-scene/

                I've post similar message in different forums

                http://www.ogre3d.org/forums/viewtopic.php?f=2&t=79649&p=499433#p499433

                My problem is very similar to yours. I 'm using a special version of QtOgre
                and I don't understand how to use or where to put my rendering
                loop...Because on this version the autor defined two method called
                activateOgrecontext and doneOgreContext which activate already the rendering
                process.
                But on this particulary point I don't understand how it works! Because there
                is no call to Node root->startRendering() or renderingqueue or something
                else....

                Ogre::Root* OgreEngine::startEngine()
                {
                m_resources_cfg = "resources.cfg";

                activateOgreContext();

                Ogre::Root *ogreRoot = new Ogre::Root;
                Ogre::RenderSystem *renderSystem = ogreRoot->getRenderSystemByName("OpenGL
                Rendering Subsystem");
                ogreRoot->setRenderSystem(renderSystem);
                ogreRoot->initialise(false);

                Ogre::NameValuePairList params;

                params["externalGLControl"] = "true";
                params["currentGLContext"] = "true";

                //Finally create our window.
                m_ogreWindow = ogreRoot->createRenderWindow("OgreWindow", 1, 1, false,
                &params);
                m_ogreWindow->setVisible(false);
                m_ogreWindow->update(false);

                doneOgreContext();

                return ogreRoot;
                }

                void OgreEngine::activateOgreContext()
                {
                glPopAttrib();
                glPopClientAttrib();

                m_qtContext->functions()->glUseProgram(0);
                m_qtContext->doneCurrent();

                m_ogreContext->makeCurrent(m_quickWindow);
                }

                void OgreEngine::doneOgreContext()
                {
                m_ogreContext->functions()->glBindBuffer(GL_ARRAY_BUFFER, 0);
                m_ogreContext->functions()->glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
                m_ogreContext->functions()->glBindRenderbuffer(GL_RENDERBUFFER, 0);
                m_ogreContext->functions()->glBindFramebuffer(GL_FRAMEBUFFER_EXT, 0);

                // unbind all possible remaining buffers; just to be on safe side
                m_ogreContext->functions()->glBindBuffer(GL_ARRAY_BUFFER, 0);
                m_ogreContext->functions()->glBindBuffer(GL_ATOMIC_COUNTER_BUFFER, 0);
                m_ogreContext->functions()->glBindBuffer(GL_COPY_READ_BUFFER, 0);
                m_ogreContext->functions()->glBindBuffer(GL_COPY_WRITE_BUFFER, 0);
                m_ogreContext->functions()->glBindBuffer(GL_DRAW_INDIRECT_BUFFER, 0);
                // m_ogreContext->functions()->glBindBuffer(GL_DISPATCH_INDIRECT_BUFFER, 0);
                m_ogreContext->functions()->glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
                m_ogreContext->functions()->glBindBuffer(GL_PIXEL_PACK_BUFFER, 0);
                m_ogreContext->functions()->glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);
                // m_ogreContext->functions()->glBindBuffer(GL_SHADER_STORAGE_BUFFER, 0);
                m_ogreContext->functions()->glBindBuffer(GL_TEXTURE_BUFFER, 0);
                m_ogreContext->functions()->glBindBuffer(GL_TRANSFORM_FEEDBACK_BUFFER, 0);
                m_ogreContext->functions()->glBindBuffer(GL_UNIFORM_BUFFER, 0);

                m_ogreContext->doneCurrent();

                m_qtContext->makeCurrent(m_quickWindow);
                glPushAttrib(GL_ALL_ATTRIB_BITS);
                glPushClientAttrib(GL_CLIENT_ALL_ATTRIB_BITS);
                }

                when you want to draw something but only in initialisation you do :

                void ExampleApp::initialize()
                {

                // we only want to initialize once
                disconnect(this, &ExampleApp::beforeRendering, this,
                &ExampleApp::initializeOgre);

                // start up Ogre
                m_ogreEngine = new OgreEngine(this);
                m_root = m_ogreEngine->startEngine();
                m_ogreEngine->setupResources();

                m_ogreEngine->activateOgreContext();

                //draw a small cube
                new DebugDrawer(m_sceneManager, 0.5f);
                DrawCube(100,100,100);
                DebugDrawer::getSingleton().build();

                m_ogreEngine->doneOgreContext();
                emit(ogreInitialized());

                }

                after read somme tutorial i've try to loop the rendering process :

                void ExampleApp::initialize()
                {

                // we only want to initialize once
                disconnect(this, &ExampleApp::beforeRendering, this,
                &ExampleApp::initializeOgre);

                // start up Ogre
                m_ogreEngine = new OgreEngine(this);
                m_root = m_ogreEngine->startEngine();
                m_ogreEngine->setupResources();

                pRenderWindow=m_ogreEngine->getRenderWindow();

                //initialisation we create a first scene and the frame listener
                m_ogreEngine->activateOgreContext();
                createScene();
                createFrameListener();
                m_ogreEngine->doneOgreContext();
                emit(ogreInitialized());

                m_ogreEngine->activateOgreContext();

                if(!m_root->renderOneFrame())
                std::cout<<"root renderOneFrame"<<std::endl;

                // La Boucle de rendu
                m_root->startRendering();

                //createScene();
                while(true)
                {
                Ogre::WindowEventUtilities::messagePump();

                if(pRenderWindow->isClosed())
                std::cout<<"pRenderWindow close"<<std::endl;

                if(!m_root->renderOneFrame())
                std::cout<<"root renderOneFrame"<<std::endl;
                }

                m_ogreEngine->doneOgreContext();
                emit(ogreInitialized());

                }

                But my app freeze...

                Do you have an idea?

                1 Reply Last reply
                0
                • H Offline
                  H Offline
                  hugox
                  wrote on last edited by
                  #10

                  sorry for the presentation but I have no choice in type of presentation (texte , code ,....)

                  :|

                  1 Reply Last reply
                  0
                  • H Offline
                    H Offline
                    hugox
                    wrote on last edited by
                    #11

                    Last try!

                    Hi,

                    My name is hugo and i’m working on a adaptation of ogre3D engine
                    using qt5 :
                    http://advancingusability.wordpress.com/2013/03/30/how-to-integrate-ogre3d-into-a-qt5-qml-scene/

                    I’ve post similar message in different forums

                    http://www.ogre3d.org/forums/viewtopic.php?f=2&t=79649&p=499433#p499433

                    My problem is very similar to yours. I ‘m using a special version of QtOgre
                    and I don’t understand how to use or where to put my rendering
                    loop…Because on this version the autor defined two method called
                    activateOgrecontext and doneOgreContext which activate already the rendering
                    process.
                    But on this particulary point I don’t understand how it works! Because there
                    is no call to Node root->startRendering() or renderingqueue or something
                    else….
                    @
                    Ogre::Root* OgreEngine::startEngine()
                    { m_resources_cfg = “resources.cfg”;
                    activateOgreContext(); Ogre::Root *ogreRoot = new Ogre::Root; Ogre::RenderSystem *renderSystem = ogreRoot->getRenderSystemByName(“OpenGL Rendering Subsystem”); ogreRoot->setRenderSystem(renderSystem); ogreRoot->initialise(false); Ogre::NameValuePairList params; params[“externalGLControl”] = “true”; params[“currentGLContext”] = “true”; //Finally create our window. m_ogreWindow = ogreRoot->createRenderWindow(“OgreWindow”, 1, 1, false, &params); m_ogreWindow->setVisible(false); m_ogreWindow->update(false); doneOgreContext(); return ogreRoot; }
                    @
                    @
                    void OgreEngine::activateOgreContext()
                    { glPopAttrib(); glPopClientAttrib();
                    m_qtContext->functions()->glUseProgram(0); m_qtContext->doneCurrent(); m_ogreContext->makeCurrent(m_quickWindow); }

                    void OgreEngine::doneOgreContext()
                    { m_ogreContext->functions()->glBindBuffer(GL_ARRAY_BUFFER, 0); m_ogreContext->functions()->glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); m_ogreContext->functions()->glBindRenderbuffer(GL_RENDERBUFFER, 0); m_ogreContext->functions()->glBindFramebuffer(GL_FRAMEBUFFER_EXT, 0);
                    // unbind all possible remaining buffers; just to be on safe side m_ogreContext->functions()->glBindBuffer(GL_ARRAY_BUFFER, 0); m_ogreContext->functions()->glBindBuffer(GL_ATOMIC_COUNTER_BUFFER, 0); m_ogreContext->functions()->glBindBuffer(GL_COPY_READ_BUFFER, 0); m_ogreContext->functions()->glBindBuffer(GL_COPY_WRITE_BUFFER, 0); m_ogreContext->functions()->glBindBuffer(GL_DRAW_INDIRECT_BUFFER, 0); // m_ogreContext->functions()->glBindBuffer(GL_DISPATCH_INDIRECT_BUFFER, 0); m_ogreContext->functions()->glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); m_ogreContext->functions()->glBindBuffer(GL_PIXEL_PACK_BUFFER, 0); m_ogreContext->functions()->glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0); // m_ogreContext->functions()->glBindBuffer(GL_SHADER_STORAGE_BUFFER, 0); m_ogreContext->functions()->glBindBuffer(GL_TEXTURE_BUFFER, 0); m_ogreContext->functions()->glBindBuffer(GL_TRANSFORM_FEEDBACK_BUFFER, 0); m_ogreContext->functions()->glBindBuffer(GL_UNIFORM_BUFFER, 0); m_ogreContext->doneCurrent(); m_qtContext->makeCurrent(m_quickWindow); glPushAttrib(GL_ALL_ATTRIB_BITS); glPushClientAttrib(GL_CLIENT_ALL_ATTRIB_BITS); }
                    @
                    when you want to draw something but only in initialisation you do :
                    @
                    void ExampleApp::initialize()
                    {
                    // we only want to initialize once disconnect(this, &ExampleApp::beforeRendering, this, &ExampleApp::initializeOgre); // start up Ogre m_ogreEngine = new OgreEngine(this); m_root = m_ogreEngine->startEngine(); m_ogreEngine->setupResources(); m_ogreEngine->activateOgreContext(); //draw a small cube new DebugDrawer(m_sceneManager, 0.5f); DrawCube(100,100,100); DebugDrawer::getSingleton().build(); m_ogreEngine->doneOgreContext(); emit(ogreInitialized());

                    }
                    @
                    after read somme tutorial i’ve try to loop the rendering process :

                    @
                    void ExampleApp::initialize() { // we only want to initialize once disconnect(this, &ExampleApp::beforeRendering, this, &ExampleApp::initializeOgre); // start up Ogre m_ogreEngine = new OgreEngine(this); m_root = m_ogreEngine->startEngine(); m_ogreEngine->setupResources(); pRenderWindow=m_ogreEngine->getRenderWindow(); //initialisation we create a first scene and the frame listener m_ogreEngine->activateOgreContext(); createScene(); createFrameListener(); m_ogreEngine->doneOgreContext(); emit(ogreInitialized()); m_ogreEngine->activateOgreContext(); if(!m_root->renderOneFrame()) std::cout<<“root renderOneFrame”<<std::endl; // La Boucle de rendu m_root->startRendering(); //createScene(); while(true) { Ogre::WindowEventUtilities::messagePump(); if(pRenderWindow->isClosed()) std::cout<<“pRenderWindow close”<<std::endl; if(!m_root->renderOneFrame()) std::cout<<“root renderOneFrame”<<std::endl; } m_ogreEngine->doneOgreContext(); emit(ogreInitialized()); }
                    @

                    But my app freeze…

                    Do you have an idea?

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

                      Your better off not using Qt at all in regards to a 3D Game Engine. I worked on it for years with developers from Irrlicht, Ogre3D, Horde3D, Gameplay3D, OSG, SFML2, .... and have even tried to assist commercial Game Engine developers (Leadwerks) . You will solve one problem with integration and expose ten other issues. The way Qt's abstraction and just in general its designed is bad for games or external 3d graphics engines.

                      Qt5 makes the problem even worse.

                      I won't go into it, because core Qt devs never listen and tempers just git heated. But if you want to know what the problems are do a google search.

                      Without a huge amount of effort re-factoring some of Qt's core components like Autodesk or The Foundry had to do to get things to work out its not going to happen.

                      Valve, Leadwerks, Gameplay, ... all just used Gtk.

                      If you have the skills you would be even better off using ...

                      Poco C++
                      Boost
                      Luajit and Luawrapper
                      SFML2
                      Bullet

                      And OpenGL 4.3 or better
                      http://ogldev.atspace.co.uk/index.html

                      1. Drawing a pixel
                      2. Triangle
                      3. Shaders
                      4. Uniform Variables
                      5. Translation Transformation
                      6. Rotation Transformation
                      7. Scaling Transformation
                      8. Interpolation
                      9. Indexed Draws
                      10. Concatenating Transformations
                      11. Perspective Projection
                      12. Camera Space
                      13. Camera Control 1
                      14. Camera Control 2
                      15. Basic Texture Mapping
                      16. Ambient Lighting
                      17. Diffuse Lighting
                      18. Specular Lighting
                      19. Point Lighting
                      20. Spot Lighting
                      21. Loading Models with Assimp
                      22. Shadow Mapping - Part 1
                      23. Shadow Mapping - Part 2
                      24. Skybox
                      25. Normal Mapping
                      26. Billboarding and Geometry Shaders
                      27. Particle System Using Transform Feedback
                      28. 3D Picking
                      29. Basic Tessellation
                      30. PN Triangle Tessellation
                      31. Vertex Array Objects
                      32. Instance Rendering
                      33. GLFX - OpenGL Effects Library
                      34. Deferred Shading - Part 1
                      35. Deferred Shading - Part 2
                      36. Deferred Shading - Part 3
                      37. Skeletal Animation with Assimp
                      38. Silhouette Detection
                      39. Stencil Shadow Volume
                      40. Object Motion Blur

                      http://nopper.tv/norbert/opengl.html

                      1. Rendering a Triangle
                      2. Grey Filter
                      3. Perspective Rendering a Cube
                      4. Phong rendering of a sphere
                      5. Texturing a Cube
                      6. Normal Mapping
                      7. Enviroment/cube mapping
                      8. GPU Particles
                      9. Geometry Shaders
                      10. Reflection and Refraction
                      11. Shadow Mapping
                      12. Simple Tessellation
                      13. Terrain Rendering
                      14. Water Rendering
                      15. Model Loading and Rendering
                      16. Clipping Planes and two sided Rendering
                      17. Using Stencil Buffer and Clipping
                      18. Rendering to texture and planar reflection
                      19. Texture matrix, alpha blending and discarding
                      20. Compute Shaders
                      21. Shadow Volumes
                      22. Displacement Mapping
                      23. Erode effect using perlin noise
                      24. Model with groups and materials
                      25. Fur rendering
                      26. Projection shadow for directional lighting
                      27. Screen Space Ambient Occlusion (SSAO)
                      28. CPU ray tracing
                      29. GPU ray tracing using computer shader.

                      http://antongerdelan.net/opengl/index.html

                      1. Hello Triangle
                      2. Extended Initialisation
                      3. Shaders
                      4. Vertex Buffers
                      5. Matrices and Vectors
                      6. Virtual Camera
                      7. Quaternion Quick-Start
                      8. Ray-Based Picking
                      9. Phong Lighting
                      10. Texture Maps
                      11. Importing a Mesh
                      12. Multi-Texturing
                      13. Using Textures for Light Coefficients
                      14. Fragment Rejection
                      15. Alpha Blending for Transparency
                      16. Spotlights and Directional Lights
                      17. Distance Fog
                      18. Normal Mapping
                      19. Cube Maps: Sky Boxes and Enviroment Mapping
                      20. Geometry Shaders
                      21. Tessellation Shaders
                      22. Overlay Panels
                      23. Sprite Sheets and 2D Animation
                      24. Bitmap Fonts
                      25. Vertex Displacement Animation
                      26. Particle Systems
                      27. Hardware Skinning
                      28. Morph Target Animation
                      29. Switching Framebuffer
                      30. Image Processing with a Kernel
                      31. Colour-Based Picking
                      32. Deferred Shading
                      33. Texture Projection Shadows

                      http://www.opengl-tutorial.org/

                      1. Opening a window
                      2. The first triangle
                      3. Matrices
                      4. A Colored Cube
                      5. A Textured Cube
                      6. Keyboard and Mouse
                      7. Model loading
                      8. Basic shading
                      9. VBO Indexing
                      10. Transparency
                      11. 2D text
                      12. OpenGL Extensions
                      13. Normal Mapping
                      14. Render To Texture
                      15. Lightmaps
                      16. Shadow mapping
                      17. Rotations
                      18. Billboards & Particles
                      19. Billboards - Particles / Instancing
                      20. Picking with an OpenGL hack
                      21. Picking with a physics library
                      22. Picking with custom Ray-OBB function
                      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