Started refactoring examples and got DecodeOnGPUExample working.

This commit is contained in:
David Williams
2015-02-15 12:03:31 +01:00
parent 92daf9a0c0
commit 3f849e19a4
5 changed files with 78 additions and 43 deletions

View File

@ -66,13 +66,18 @@ void createSphereInVolume(PagedVolume<uint8_t>& volData, float fRadius)
}
}
int main(int argc, char *argv[])
class BasicExample : public OpenGLWidget
{
//Create and show the Qt OpenGL window
QApplication app(argc, argv);
OpenGLWidget openGLWidget(0);
openGLWidget.show();
public:
BasicExample(QWidget *parent)
:OpenGLWidget(parent)
{
}
protected:
void initialize() override
{
//Create an empty volume and then place a sphere in it
PagedVolume<uint8_t> volData(PolyVox::Region(Vector3DInt32(0, 0, 0), Vector3DInt32(63, 63, 63)));
createSphereInVolume(volData, 30);
@ -86,9 +91,18 @@ int main(int argc, char *argv[])
auto decodedMesh = decodeMesh(mesh);
//Pass the surface to the OpenGL window
openGLWidget.addMesh(decodedMesh);
addMesh(decodedMesh);
//openGLWidget.addMesh(mesh2);
openGLWidget.setViewableRegion(volData.getEnclosingRegion());
setViewableRegion(volData.getEnclosingRegion());
}
};
int main(int argc, char *argv[])
{
//Create and show the Qt OpenGL window
QApplication app(argc, argv);
BasicExample openGLWidget(0);
openGLWidget.show();
//Run the message pump.
return app.exec();