diff options
author | Sergey Dubitskiy <sergey.dubitskiy@nokia.com> | 2012-02-13 14:27:29 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-02-14 01:37:52 +0100 |
commit | 35e1fc8ae0ef05eb59c55de707813233757de456 (patch) | |
tree | 943869f40c9f571840749d79f2b0265a52fae5b8 /examples/qt3d/tank/quadplane.cpp | |
parent | 00d127f73034c0aa4b21db5ef13490ea2ddf65b8 (diff) |
Resource handling needs refactoring.
Phase Two:
Fix all C++based demos/examples/tutorials.
Call cleanupResources() for all textures created.
Task-number: QTBUG-24043
Change-Id: I4bef23f7fe56e092de79bb91b41d6d691329b2cf
Reviewed-by: Sarah Jane Smith <sarah.j.smith@nokia.com>
Reviewed-by: Danny Pope <daniel.pope@nokia.com>
Diffstat (limited to 'examples/qt3d/tank/quadplane.cpp')
-rw-r--r-- | examples/qt3d/tank/quadplane.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/examples/qt3d/tank/quadplane.cpp b/examples/qt3d/tank/quadplane.cpp index 16b416da1..16935c912 100644 --- a/examples/qt3d/tank/quadplane.cpp +++ b/examples/qt3d/tank/quadplane.cpp @@ -70,6 +70,7 @@ QGLMaterial *qCreateFloor() QuadPlane::QuadPlane(QObject *parent, QSizeF size, int level) : QGLSceneNode(parent) + , m_texture(0) { setObjectName("QuadPlane"); if (level > 8) @@ -102,9 +103,18 @@ QuadPlane::QuadPlane(QObject *parent, QSizeF size, int level) } QGLSceneNode *n = builder.finalizedSceneNode(); addNode(n); - n->setMaterial(qCreateFloor()); + QGLMaterial *mat = qCreateFloor(); + m_texture = mat->texture(); + n->setMaterial(mat); QGraphicsRotation3D *rot = new QGraphicsRotation3D(n); rot->setAxis(QVector3D(1, 0, 0)); rot->setAngle(90.0f); n->addTransform(rot); } + +QuadPlane::~QuadPlane() +{ + if (m_texture) + m_texture->cleanupResources(); +} + |