Converting OpenGLExample to use common OpenGLWidget.

This commit is contained in:
David Williams
2014-05-23 22:18:17 +02:00
parent d34fd6b3c8
commit 34f57911a7
10 changed files with 12 additions and 728 deletions

View File

@ -22,6 +22,7 @@ freely, subject to the following restrictions:
*******************************************************************************/
#include "PolyVoxCore/FilePager.h"
#include "PolyVoxCore/MarchingCubesSurfaceExtractor.h"
#include "PolyVoxCore/MaterialDensityPair.h"
#include "PolyVoxCore/LargeVolume.h"
#include "PolyVoxCore/LowPassFilter.h"
@ -30,8 +31,6 @@ freely, subject to the following restrictions:
#include "PolyVoxCore/Mesh.h"
#include "PolyVoxCore/Impl/Utility.h"
#include "OpenGLImmediateModeSupport.h"
#include "OpenGLVertexBufferObjectSupport.h"
#include "Shapes.h"
#include "OpenGLWidget.h"
@ -48,6 +47,8 @@ using namespace std;
using namespace PolyVox;
using namespace std;
const int32_t g_uVolumeSideLength = 128;
int main(int argc, char *argv[])
{
RLEBlockCompressor<MaterialDensityPair44>* compressor = new RLEBlockCompressor<MaterialDensityPair44>();
@ -98,9 +99,16 @@ int main(int argc, char *argv[])
QTime time;
time.start();
openGLWidget.setVolume(&volData);
//openGLWidget.setVolume(&volData);
cout << endl << "Time taken = " << time.elapsed() / 1000.0f << "s" << endl << endl;
auto mesh = extractMarchingCubesMesh(&volData, volData.getEnclosingRegion());
//Pass the surface to the OpenGL window
openGLWidget.addMesh(mesh);
//openGLWidget.addMesh(mesh2);
openGLWidget.setViewableRegion(volData.getEnclosingRegion());
//return 0;
return app.exec();