diff --git a/examples/OpenGL/CMakeLists.txt b/examples/OpenGL/CMakeLists.txt index 97b3cf2f..0bd0d683 100644 --- a/examples/OpenGL/CMakeLists.txt +++ b/examples/OpenGL/CMakeLists.txt @@ -9,6 +9,7 @@ SET(SRC_FILES OpenGLImmediateModeSupport.cpp OpenGLSupport.cpp OpenGLVertexBufferObjectSupport.cpp + OpenGLWidget.cpp Shapes.cpp ) @@ -20,6 +21,7 @@ SET(INC_FILES OpenGLImmediateModeSupport.h OpenGLSupport.h OpenGLVertexBufferObjectSupport.h + OpenGLWidget.h Shapes.h ) @@ -33,6 +35,11 @@ SET(CMAKE_DEBUG_POSTFIX "_d") SOURCE_GROUP("Sources" FILES ${SRC_FILES}) #SOURCE_GROUP("Headers" FILES ${INC_FILES}) +FIND_PACKAGE(Qt4) +SET(QT_USE_QTGUI 1) +SET(QT_USE_QTOPENGL 1) +INCLUDE(${QT_USE_FILE}) + IF (WIN32) FIND_PACKAGE(OpenGL REQUIRED) @@ -43,12 +50,11 @@ IF (WIN32) #Tell CMake the paths for OpenGL and for PolyVox (which is just relative to our current location) INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS} ${OPENGL_INCLUDE_DIR} "../../library/include") - #No idea why we have to look three levels up for build and only two for include. They should be the same level?! - LINK_DIRECTORIES("../../../build/library") + LINK_DIRECTORIES("../../library") #Build ADD_EXECUTABLE(OpenGLExample ${SRC_FILES}) - TARGET_LINK_LIBRARIES(OpenGLExample glut32.lib ${OPENGL_gl_LIBRARY} debug PolyVoxCore_d.lib optimized PolyVoxCore.lib) + TARGET_LINK_LIBRARIES(OpenGLExample ${QT_LIBRARIES} ${OPENGL_gl_LIBRARY} debug PolyVoxCore_d.lib optimized PolyVoxCore.lib) #Install INSTALL(TARGETS OpenGLExample diff --git a/examples/OpenGL/OpenGLWidget.cpp b/examples/OpenGL/OpenGLWidget.cpp new file mode 100644 index 00000000..d46109ba --- /dev/null +++ b/examples/OpenGL/OpenGLWidget.cpp @@ -0,0 +1,19 @@ +#include "OpenGLWidget.h" + + +OpenGLWidget::OpenGLWidget(QWidget *parent) + :QGLWidget(parent) +{ +} + +void OpenGLWidget::initializeGL() +{ +} + +void OpenGLWidget::resizeGL(int w, int h) +{ +} + +void OpenGLWidget::paintGL() +{ +} \ No newline at end of file diff --git a/examples/OpenGL/OpenGLWidget.h b/examples/OpenGL/OpenGLWidget.h new file mode 100644 index 00000000..799ade9c --- /dev/null +++ b/examples/OpenGL/OpenGLWidget.h @@ -0,0 +1,19 @@ +#ifndef __PolyVox_OpenGLWidget_H__ +#define __PolyVox_OpenGLWidget_H__ + +#include + +class OpenGLWidget : public QGLWidget + { + + public: + OpenGLWidget(QWidget *parent); + + protected: + void initializeGL(); + void resizeGL(int w, int h); + void paintGL(); + + }; + +#endif //__PolyVox_OpenGLWidget_H__ \ No newline at end of file diff --git a/examples/OpenGL/main.cpp b/examples/OpenGL/main.cpp index fe66eae8..ac8d9a7d 100644 --- a/examples/OpenGL/main.cpp +++ b/examples/OpenGL/main.cpp @@ -7,9 +7,24 @@ #include "OpenGLVertexBufferObjectSupport.h" #include "Shapes.h" +#include "OpenGLWidget.h" + #include // Standard Header For Most Programs -//#define USE_OPENGL_VERTEX_BUFFERS_OBJECTS +#include + + +int main(int argc, char *argv[]) + { + QApplication app(argc, argv); + + OpenGLWidget openGLWidget(0); + + openGLWidget.show(); + return app.exec(); + } + +#ifdef USING_GLUT #ifdef WIN32 #include "glew/glew.h" @@ -271,4 +286,6 @@ void main ( int argc, char** argv ) // Create Main Function For Bringing It Al init (); glutMainLoop ( ); // Initialize The Main Loop -} \ No newline at end of file +} + +#endif //USING_GLUT \ No newline at end of file