Ogre’s viewport wont update in real time
I’m not sure why but the viewports of Ogre don’t update in realy time, i make a change then i have to resize the widget it’s in to see the affect of the command…….Here’s the class used for rendering/updating
- #include "stdafx.h"
- #include "CRenderer.h"
- #include "qwidget.h"
- void CRenderer::clearViewport()
- {
- Ogre::ColourValue cv;
- cv.r = Color2.redF();
- cv.b = Color2.blueF();
- cv.g = Color2.greenF();
- cv.a = 1.0;
- this->m_pIViewport->setBackgroundColour(cv);
- }
- {
- return 0;
- }
- {
- Ogre::Timer* time = m_pIRoot->getTimer();
- time->reset();
- Ogre::FrameEvent event;
- event.timeSinceLastFrame += time->getMillisecondsCPU();
- if(isInitialized)
- {
- Ogre::Root::getSingleton()._fireFrameStarted();
- m_pIRenderWindow->update(true);
- for (unsigned int X = 0; X < m_pIRenderWindow->getNumViewports(); ++X)
- {
- this->m_pIRenderWindow->getViewport(X)->update();
- }
- Ogre::Root::getSingleton()._fireFrameRenderingQueued();
- Ogre::Root::getSingleton()._fireFrameEnded();
- }
- }
- {
- this->resize(this->parentWidget()->width(),this->parentWidget()->height());
- if (m_pIRenderWindow)
- {
- m_pIRenderWindow->resize(this->parentWidget()->width(),this->parentWidget()->height());
- m_pIRenderWindow->windowMovedOrResized();
- for (unsigned short X = 0; X < m_pIRenderWindow->getNumViewports(); ++X)
- {
- Ogre::Viewport* views = m_pIRenderWindow->getViewport(X);
- Ogre::Camera* cam = views->getCamera();
- cam->setAspectRatio(static_cast<Ogre::Real>(views->getActualWidth())/static_cast<Ogre::Real>(views->getActualHeight()));
- m_pIRenderWindow->_updateViewport(views);
- }
- }
- }
- bool CRenderer::DrawScene()
- {
- return true;
- }
- {
- Ogre::Entity* Cube = m_pSceneMgr->getEntity("Ogre");
- Ogre::SceneNode* N = Cube->getParentSceneNode();
- {
- m_pIRenderWindow->_beginUpdate();
- N->pitch(-Ogre::Degree(lastPos.rx()));
- N->yaw(-Ogre::Degree(lastPos.ry()));
- m_pIViewport->update();
- m_pIRenderWindow->_endUpdate();
- }
- }
- {
- }
- {
- lastPos = event->pos();
- }
- {
- {
- MessageBoxA(NULL,"","",MB_OK);
- }
- }
- {
- }
- {
- }
- {
- {
- m_pIRenderWindow->_beginUpdate();
- m_pIRenderWindow->setActive(true);
- m_pIViewport->update();
- m_pIRenderWindow->_endUpdate();
- }
- }
Yes, it’s long…but if i can figure out how to fix it in this widget then making sure that the viewport updates in real time in all the other windows will be easy
7 replies
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. :)
…. 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.
Taamalus, it should be Qt, QT is Quick Time :)
You must log in to post a reply. Not a member yet? Register here!


