diff --git a/examples/Basic/OpenGLWidget.h b/examples/Basic/OpenGLWidget.h index d03cb378..0e35819b 100644 --- a/examples/Basic/OpenGLWidget.h +++ b/examples/Basic/OpenGLWidget.h @@ -26,9 +26,7 @@ distribution. #include "SurfaceMesh.h" -#ifdef WIN32 #include "glew/glew.h" -#endif #include @@ -55,7 +53,7 @@ private: //Index/vertex buffer data GLuint m_uBeginIndex; GLuint m_uEndIndex; - GLulong noOfIndices; + GLuint noOfIndices; GLuint indexBuffer; GLuint vertexBuffer; diff --git a/examples/Basic/main.cpp b/examples/Basic/main.cpp index 506e94b3..b0b92abc 100644 --- a/examples/Basic/main.cpp +++ b/examples/Basic/main.cpp @@ -30,10 +30,8 @@ freely, subject to the following restrictions: #include -//Some namespaces we need -using namespace std; +//Use the PolyVox namespace using namespace PolyVox; -using namespace std; void createSphereInVolume(Volume& volData, float fRadius, uint8_t uValue) { @@ -71,28 +69,24 @@ void createSphereInVolume(Volume& volData, float fRadius, } } - -const uint16_t g_uVolumeSideLength = 64; - int main(int argc, char *argv[]) { + //Create and show the Qt OpenGL window QApplication app(argc, argv); OpenGLWidget openGLWidget(0); openGLWidget.show(); - Volume volData(g_uVolumeSideLength, g_uVolumeSideLength, g_uVolumeSideLength); - + //Create an empty volume and then place a sphere in it + Volume volData(64, 64, 64); createSphereInVolume(volData, 30, 1); + //Extract the surface SurfaceExtractor surfaceExtractor(volData); - shared_ptr surface = surfaceExtractor.extractSurfaceForRegion(volData.getEnclosingRegion()); - //OpenGLSurfaceMesh mesh = BuildOpenGLSurfaceMesh(*surface); - - - //openGLWidget.mesh = BuildOpenGLSurfaceMesh(*(surface.get())); - //openGLWidget.surfaceMesh = *surface; + //Pass the surface to the OpenGL window openGLWidget.setSurfaceMeshToRender(*surface); + + //Run the message pump. return app.exec(); }