Switched to using Qt for loading extensions, instead of GLEW.
This commit is contained in:
parent
f042584ed5
commit
ec80bfe740
@ -32,17 +32,13 @@ SET(INC_FILES
|
||||
../common/OpenGLWidget.h
|
||||
)
|
||||
|
||||
add_definitions(-DGLEW_STATIC)
|
||||
|
||||
#"Sources" and "Headers" are the group names in Visual Studio.
|
||||
#They may have other uses too...
|
||||
SOURCE_GROUP("Sources" FILES ${SRC_FILES})
|
||||
SOURCE_GROUP("Headers" FILES ${INC_FILES})
|
||||
|
||||
FIND_PACKAGE(OpenGL REQUIRED)
|
||||
|
||||
#Tell CMake the paths for OpenGL and for PolyVox (which is just relative to our current location)
|
||||
INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR} ${PolyVoxHeaders_SOURCE_DIR} ${GLEW_SOURCE_DIR})
|
||||
INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR} ${PolyVoxHeaders_SOURCE_DIR} ../common)
|
||||
|
||||
#This will include the shader files inside the compiled binary
|
||||
QT5_ADD_RESOURCES(COMMON_RESOURCES_RCC ../common/example.qrc)
|
||||
@ -55,7 +51,7 @@ ADD_EXECUTABLE(BasicExample ${SRC_FILES} ${COMMON_RESOURCES_RCC})
|
||||
IF(MSVC)
|
||||
SET_TARGET_PROPERTIES(BasicExample PROPERTIES COMPILE_FLAGS "/W4 /wd4127") #All warnings
|
||||
ENDIF(MSVC)
|
||||
TARGET_LINK_LIBRARIES(BasicExample glew Qt5::OpenGL ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY})
|
||||
TARGET_LINK_LIBRARIES(BasicExample Qt5::OpenGL)
|
||||
SET_PROPERTY(TARGET BasicExample PROPERTY FOLDER "Examples")
|
||||
|
||||
#Install - Only install the example in Windows
|
||||
|
@ -34,12 +34,8 @@ SET(INC_FILES
|
||||
OpenGLWidget.h
|
||||
)
|
||||
|
||||
add_definitions(-DGLEW_STATIC)
|
||||
|
||||
FIND_PACKAGE(OpenGL REQUIRED)
|
||||
|
||||
#Tell CMake the paths for OpenGL and for PolyVox (which is just relative to our current location)
|
||||
INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR} ${PolyVoxHeaders_SOURCE_DIR} ${GLEW_SOURCE_DIR})
|
||||
INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR} ${PolyVoxHeaders_SOURCE_DIR})
|
||||
|
||||
#This will include the shader files inside the compiled binary
|
||||
QT4_ADD_RESOURCES(COMMON_RESOURCES_RCC ../common/example.qrc)
|
||||
@ -53,7 +49,7 @@ ADD_EXECUTABLE(DecodeOnGPUExample ${SRC_FILES} ${COMMON_RESOURCES_RCC} ${DECODE_
|
||||
IF(MSVC)
|
||||
SET_TARGET_PROPERTIES(DecodeOnGPUExample PROPERTIES COMPILE_FLAGS "/W4 /wd4127")
|
||||
ENDIF(MSVC)
|
||||
TARGET_LINK_LIBRARIES(DecodeOnGPUExample glew ${QT_LIBRARIES} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY})
|
||||
TARGET_LINK_LIBRARIES(DecodeOnGPUExample ${QT_LIBRARIES})
|
||||
SET_PROPERTY(TARGET DecodeOnGPUExample PROPERTY FOLDER "Examples")
|
||||
|
||||
#Install - Only install the example in Windows
|
||||
|
@ -42,17 +42,13 @@ SET(INC_FILES
|
||||
Shapes.h
|
||||
)
|
||||
|
||||
add_definitions(-DGLEW_STATIC)
|
||||
|
||||
#"Sources" and "Headers" are the group names in Visual Studio.
|
||||
#They may have other uses too...
|
||||
SOURCE_GROUP("Sources" FILES ${SRC_FILES})
|
||||
SOURCE_GROUP("Headers" FILES ${INC_FILES})
|
||||
|
||||
FIND_PACKAGE(OpenGL REQUIRED)
|
||||
|
||||
#Tell CMake the paths for OpenGL and for PolyVox (which is just relative to our current location)
|
||||
INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR} ${PolyVoxHeaders_SOURCE_DIR} ${GLEW_SOURCE_DIR})
|
||||
INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR} ${PolyVoxHeaders_SOURCE_DIR} ../common)
|
||||
|
||||
#This will include the shader files inside the compiled binary
|
||||
QT5_ADD_RESOURCES(COMMON_RESOURCES_RCC ../common/example.qrc)
|
||||
@ -66,7 +62,7 @@ ADD_EXECUTABLE(OpenGLExample ${SRC_FILES} ${COMMON_RESOURCES_RCC} ${OPENGL_EXAMP
|
||||
IF(MSVC)
|
||||
SET_TARGET_PROPERTIES(OpenGLExample PROPERTIES COMPILE_FLAGS "/W4 /wd4127")
|
||||
ENDIF(MSVC)
|
||||
TARGET_LINK_LIBRARIES(OpenGLExample glew Qt5::OpenGL ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY})
|
||||
TARGET_LINK_LIBRARIES(OpenGLExample Qt5::OpenGL)
|
||||
SET_PROPERTY(TARGET OpenGLExample PROPERTY FOLDER "Examples")
|
||||
|
||||
#Install - Only install the example in Windows
|
||||
|
@ -34,17 +34,13 @@ SET(INC_FILES
|
||||
Perlin.h
|
||||
)
|
||||
|
||||
add_definitions(-DGLEW_STATIC)
|
||||
|
||||
#"Sources" and "Headers" are the group names in Visual Studio.
|
||||
#They may have other uses too...
|
||||
SOURCE_GROUP("Sources" FILES ${SRC_FILES})
|
||||
SOURCE_GROUP("Headers" FILES ${INC_FILES})
|
||||
|
||||
FIND_PACKAGE(OpenGL REQUIRED)
|
||||
|
||||
#Tell CMake the paths for OpenGL and for PolyVox (which is just relative to our current location)
|
||||
INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR} ${PolyVoxHeaders_SOURCE_DIR} ${GLEW_SOURCE_DIR})
|
||||
INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR} ${PolyVoxHeaders_SOURCE_DIR} ../common)
|
||||
|
||||
#This will include the shader files inside the compiled binary
|
||||
QT5_ADD_RESOURCES(COMMON_RESOURCES_RCC ../common/example.qrc)
|
||||
@ -57,7 +53,7 @@ ADD_EXECUTABLE(PagingExample ${SRC_FILES} ${COMMON_RESOURCES_RCC})
|
||||
IF(MSVC)
|
||||
SET_TARGET_PROPERTIES(PagingExample PROPERTIES COMPILE_FLAGS "/W4 /wd4127")
|
||||
ENDIF(MSVC)
|
||||
TARGET_LINK_LIBRARIES(PagingExample glew Qt5::OpenGL ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY})
|
||||
TARGET_LINK_LIBRARIES(PagingExample Qt5::OpenGL)
|
||||
SET_PROPERTY(TARGET PagingExample PROPERTY FOLDER "Examples")
|
||||
|
||||
#Install - Only install the example in Windows
|
||||
|
@ -32,17 +32,13 @@ SET(INC_FILES
|
||||
../common/OpenGLWidget.h
|
||||
)
|
||||
|
||||
add_definitions(-DGLEW_STATIC)
|
||||
|
||||
#"Sources" and "Headers" are the group names in Visual Studio.
|
||||
#They may have other uses too...
|
||||
SOURCE_GROUP("Sources" FILES ${SRC_FILES})
|
||||
SOURCE_GROUP("Headers" FILES ${INC_FILES})
|
||||
|
||||
FIND_PACKAGE(OpenGL REQUIRED)
|
||||
|
||||
#Tell CMake the paths for OpenGL and for PolyVox (which is just relative to our current location)
|
||||
INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR} ${PolyVoxHeaders_SOURCE_DIR} ${GLEW_SOURCE_DIR})
|
||||
INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR} ${PolyVoxHeaders_SOURCE_DIR} ../common)
|
||||
|
||||
#This will include the shader files inside the compiled binary
|
||||
QT5_ADD_RESOURCES(COMMON_RESOURCES_RCC ../common/example.qrc)
|
||||
@ -55,7 +51,7 @@ ADD_EXECUTABLE(SmoothLODExample ${SRC_FILES} ${COMMON_RESOURCES_RCC})
|
||||
IF(MSVC)
|
||||
SET_TARGET_PROPERTIES(SmoothLODExample PROPERTIES COMPILE_FLAGS "/W4 /wd4127") #All warnings
|
||||
ENDIF(MSVC)
|
||||
TARGET_LINK_LIBRARIES(SmoothLODExample glew Qt5::OpenGL ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY})
|
||||
TARGET_LINK_LIBRARIES(SmoothLODExample Qt5::OpenGL)
|
||||
SET_PROPERTY(TARGET SmoothLODExample PROPERTY FOLDER "Examples")
|
||||
|
||||
#Install - Only install the example in Windows
|
||||
|
@ -19,13 +19,11 @@
|
||||
# 3. This notice may not be removed or altered from any source
|
||||
# distribution.
|
||||
|
||||
project(GLEW)
|
||||
#project(GLEW)
|
||||
|
||||
set(SRC_FILES ../common/glew/glew.cpp)
|
||||
|
||||
add_definitions(-DGLEW_STATIC)
|
||||
#set(SRC_FILES ../common/glew/glew.cpp)
|
||||
|
||||
#find_package(OpenGL REQUIRED)
|
||||
#include_directories(${OPENGL_INCLUDE_DIR})
|
||||
add_library(glew STATIC ${SRC_FILES})
|
||||
SET_PROPERTY(TARGET glew PROPERTY FOLDER "Examples/Common")
|
||||
#add_library(glew STATIC ${SRC_FILES})
|
||||
#SET_PROPERTY(TARGET glew PROPERTY FOLDER "Examples/Common")
|
||||
|
@ -61,11 +61,10 @@ void OpenGLWidget::mouseMoveEvent(QMouseEvent* event)
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
void OpenGLWidget::initializeGL()
|
||||
{
|
||||
GLenum err = glewInit();
|
||||
if (GLEW_OK != err)
|
||||
if (!initializeOpenGLFunctions())
|
||||
{
|
||||
/* Problem: glewInit failed, something is seriously wrong. */
|
||||
std::cout << "GLEW Error: " << glewGetErrorString(err) << std::endl;
|
||||
std::cerr << "Could not initialize OpenGL functions" << std::endl;
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
//Print out some information about the OpenGL implementation.
|
||||
|
@ -26,10 +26,12 @@ distribution.
|
||||
|
||||
#include "PolyVox/Mesh.h"
|
||||
|
||||
#include "glew/glew.h"
|
||||
#include <QOpenGLFunctions_3_1>
|
||||
|
||||
#include <QGLWidget>
|
||||
#include <QGLShaderProgram>
|
||||
#include <QOpenGLVertexArrayObject>
|
||||
#include <QOpenGLBuffer>
|
||||
|
||||
// This structure holds all the data required
|
||||
// to render one of our meshes through OpenGL.
|
||||
@ -47,7 +49,7 @@ struct OpenGLMeshData
|
||||
// Our OpenGLWidget is used by all the examples to render the extracted meshes. It is
|
||||
// fairly specific to our needs (you probably won't want to use it in your own project)
|
||||
// but should provide a useful illustration of how PolyVox meshes can be rendered.
|
||||
class OpenGLWidget : public QGLWidget
|
||||
class OpenGLWidget : public QGLWidget, protected QOpenGLFunctions_3_1
|
||||
{
|
||||
public:
|
||||
// Constructor
|
||||
|
Loading…
x
Reference in New Issue
Block a user