diff options
author | Sergey Dubitskiy <sergey.dubitskiy@nokia.com> | 2012-07-02 15:16:40 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-07-09 03:03:41 +0200 |
commit | 1dbec879b1f6b309a0c63ef7861c4ca00c5fb12c (patch) | |
tree | c36f373617b2558c6c2d7298f1bc8106df19f3db /demos | |
parent | 04c25ce79cf781d91b9e78b3420ba54e1701aae0 (diff) |
Qt3d "Shapes" demo: cube and teapot are misplaced.
Task-number: QTBUG-26142
Change-Id: I63bcca2f67005e6cc675ec8c7f15c05870be9046
Reviewed-by: Danny Pope <daniel.pope@nokia.com>
Diffstat (limited to 'demos')
-rw-r--r-- | demos/qt3d/shapes/shapes.cpp | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/demos/qt3d/shapes/shapes.cpp b/demos/qt3d/shapes/shapes.cpp index 8ca561ceb..3bd09bc5f 100644 --- a/demos/qt3d/shapes/shapes.cpp +++ b/demos/qt3d/shapes/shapes.cpp @@ -368,19 +368,16 @@ void ShapesWidget::paintCube(QGLPainter *painter, const QRect& rect) painter->projectionMatrix().push(); painter->modelViewMatrix().push(); - QGLSubsurface surface(painter->currentSurface(), rect); - painter->pushSurface(&surface); - + QMatrix4x4 cubeTransform; + cubeTransform.translate(0,-2.5,-12); + cubeTransform.rotate(45.0f, 1.0f, 1.0f, 1.0f); + cube->setLocalTransform(cubeTransform); painter->setCamera(&camera); - painter->modelViewMatrix().rotate(45.0f, 1.0f, 1.0f, 1.0f); - cube->draw(painter); painter->projectionMatrix().pop(); painter->modelViewMatrix().pop(); - painter->popSurface(); - drawText(painter, rect, tr("Cube")); } @@ -391,14 +388,15 @@ void ShapesWidget::paintTeapot(QGLPainter *painter, const QRect& rect) painter->projectionMatrix().push(); painter->modelViewMatrix().push(); - QGLSubsurface surface(painter->currentSurface(), rect); - painter->pushSurface(&surface); - + QRect view = geometry(); + qreal aspect = ((qreal)view.width())/((qreal)view.height()); + qreal ratio = aspect/1.333; + QMatrix4x4 teapotTransform; + teapotTransform.translate(4*ratio,-2.5,-12.0); + teapot->setLocalTransform(teapotTransform); painter->setCamera(&camera); - // Need a one-sided lighting model for the teapot. painter->setLightModel(&oneSidedModel); - teapot->draw(painter); painter->setLightModel(&twoSidedModel); @@ -406,8 +404,6 @@ void ShapesWidget::paintTeapot(QGLPainter *painter, const QRect& rect) painter->projectionMatrix().pop(); painter->modelViewMatrix().pop(); - painter->popSurface(); - drawText(painter, rect, tr("Teapot")); } |