Started porting GLUT example to Qt.
This commit is contained in:
parent
50b3ff407e
commit
fc7cf98347
@ -9,6 +9,7 @@ SET(SRC_FILES
|
|||||||
OpenGLImmediateModeSupport.cpp
|
OpenGLImmediateModeSupport.cpp
|
||||||
OpenGLSupport.cpp
|
OpenGLSupport.cpp
|
||||||
OpenGLVertexBufferObjectSupport.cpp
|
OpenGLVertexBufferObjectSupport.cpp
|
||||||
|
OpenGLWidget.cpp
|
||||||
Shapes.cpp
|
Shapes.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -20,6 +21,7 @@ SET(INC_FILES
|
|||||||
OpenGLImmediateModeSupport.h
|
OpenGLImmediateModeSupport.h
|
||||||
OpenGLSupport.h
|
OpenGLSupport.h
|
||||||
OpenGLVertexBufferObjectSupport.h
|
OpenGLVertexBufferObjectSupport.h
|
||||||
|
OpenGLWidget.h
|
||||||
Shapes.h
|
Shapes.h
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -33,6 +35,11 @@ SET(CMAKE_DEBUG_POSTFIX "_d")
|
|||||||
SOURCE_GROUP("Sources" FILES ${SRC_FILES})
|
SOURCE_GROUP("Sources" FILES ${SRC_FILES})
|
||||||
#SOURCE_GROUP("Headers" FILES ${INC_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)
|
IF (WIN32)
|
||||||
FIND_PACKAGE(OpenGL REQUIRED)
|
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)
|
#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")
|
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("../../library")
|
||||||
LINK_DIRECTORIES("../../../build/library")
|
|
||||||
|
|
||||||
#Build
|
#Build
|
||||||
ADD_EXECUTABLE(OpenGLExample ${SRC_FILES})
|
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
|
||||||
INSTALL(TARGETS OpenGLExample
|
INSTALL(TARGETS OpenGLExample
|
||||||
|
19
examples/OpenGL/OpenGLWidget.cpp
Normal file
19
examples/OpenGL/OpenGLWidget.cpp
Normal file
@ -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()
|
||||||
|
{
|
||||||
|
}
|
19
examples/OpenGL/OpenGLWidget.h
Normal file
19
examples/OpenGL/OpenGLWidget.h
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
#ifndef __PolyVox_OpenGLWidget_H__
|
||||||
|
#define __PolyVox_OpenGLWidget_H__
|
||||||
|
|
||||||
|
#include <QGLWidget>
|
||||||
|
|
||||||
|
class OpenGLWidget : public QGLWidget
|
||||||
|
{
|
||||||
|
|
||||||
|
public:
|
||||||
|
OpenGLWidget(QWidget *parent);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void initializeGL();
|
||||||
|
void resizeGL(int w, int h);
|
||||||
|
void paintGL();
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif //__PolyVox_OpenGLWidget_H__
|
@ -7,9 +7,24 @@
|
|||||||
#include "OpenGLVertexBufferObjectSupport.h"
|
#include "OpenGLVertexBufferObjectSupport.h"
|
||||||
#include "Shapes.h"
|
#include "Shapes.h"
|
||||||
|
|
||||||
|
#include "OpenGLWidget.h"
|
||||||
|
|
||||||
#include <windows.h> // Standard Header For Most Programs
|
#include <windows.h> // Standard Header For Most Programs
|
||||||
|
|
||||||
//#define USE_OPENGL_VERTEX_BUFFERS_OBJECTS
|
#include <QApplication>
|
||||||
|
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
QApplication app(argc, argv);
|
||||||
|
|
||||||
|
OpenGLWidget openGLWidget(0);
|
||||||
|
|
||||||
|
openGLWidget.show();
|
||||||
|
return app.exec();
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef USING_GLUT
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
#include "glew/glew.h"
|
#include "glew/glew.h"
|
||||||
@ -271,4 +286,6 @@ void main ( int argc, char** argv ) // Create Main Function For Bringing It Al
|
|||||||
init ();
|
init ();
|
||||||
|
|
||||||
glutMainLoop ( ); // Initialize The Main Loop
|
glutMainLoop ( ); // Initialize The Main Loop
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif //USING_GLUT
|
Loading…
x
Reference in New Issue
Block a user