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
|
../common/OpenGLWidget.h
|
||||||
)
|
)
|
||||||
|
|
||||||
add_definitions(-DGLEW_STATIC)
|
|
||||||
|
|
||||||
#"Sources" and "Headers" are the group names in Visual Studio.
|
#"Sources" and "Headers" are the group names in Visual Studio.
|
||||||
#They may have other uses too...
|
#They may have other uses too...
|
||||||
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(OpenGL REQUIRED)
|
|
||||||
|
|
||||||
#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(${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
|
#This will include the shader files inside the compiled binary
|
||||||
QT5_ADD_RESOURCES(COMMON_RESOURCES_RCC ../common/example.qrc)
|
QT5_ADD_RESOURCES(COMMON_RESOURCES_RCC ../common/example.qrc)
|
||||||
@ -55,7 +51,7 @@ ADD_EXECUTABLE(BasicExample ${SRC_FILES} ${COMMON_RESOURCES_RCC})
|
|||||||
IF(MSVC)
|
IF(MSVC)
|
||||||
SET_TARGET_PROPERTIES(BasicExample PROPERTIES COMPILE_FLAGS "/W4 /wd4127") #All warnings
|
SET_TARGET_PROPERTIES(BasicExample PROPERTIES COMPILE_FLAGS "/W4 /wd4127") #All warnings
|
||||||
ENDIF(MSVC)
|
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")
|
SET_PROPERTY(TARGET BasicExample PROPERTY FOLDER "Examples")
|
||||||
|
|
||||||
#Install - Only install the example in Windows
|
#Install - Only install the example in Windows
|
||||||
|
@ -34,12 +34,8 @@ SET(INC_FILES
|
|||||||
OpenGLWidget.h
|
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)
|
#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
|
#This will include the shader files inside the compiled binary
|
||||||
QT4_ADD_RESOURCES(COMMON_RESOURCES_RCC ../common/example.qrc)
|
QT4_ADD_RESOURCES(COMMON_RESOURCES_RCC ../common/example.qrc)
|
||||||
@ -53,7 +49,7 @@ ADD_EXECUTABLE(DecodeOnGPUExample ${SRC_FILES} ${COMMON_RESOURCES_RCC} ${DECODE_
|
|||||||
IF(MSVC)
|
IF(MSVC)
|
||||||
SET_TARGET_PROPERTIES(DecodeOnGPUExample PROPERTIES COMPILE_FLAGS "/W4 /wd4127")
|
SET_TARGET_PROPERTIES(DecodeOnGPUExample PROPERTIES COMPILE_FLAGS "/W4 /wd4127")
|
||||||
ENDIF(MSVC)
|
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")
|
SET_PROPERTY(TARGET DecodeOnGPUExample PROPERTY FOLDER "Examples")
|
||||||
|
|
||||||
#Install - Only install the example in Windows
|
#Install - Only install the example in Windows
|
||||||
|
@ -42,17 +42,13 @@ SET(INC_FILES
|
|||||||
Shapes.h
|
Shapes.h
|
||||||
)
|
)
|
||||||
|
|
||||||
add_definitions(-DGLEW_STATIC)
|
|
||||||
|
|
||||||
#"Sources" and "Headers" are the group names in Visual Studio.
|
#"Sources" and "Headers" are the group names in Visual Studio.
|
||||||
#They may have other uses too...
|
#They may have other uses too...
|
||||||
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(OpenGL REQUIRED)
|
|
||||||
|
|
||||||
#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(${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
|
#This will include the shader files inside the compiled binary
|
||||||
QT5_ADD_RESOURCES(COMMON_RESOURCES_RCC ../common/example.qrc)
|
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)
|
IF(MSVC)
|
||||||
SET_TARGET_PROPERTIES(OpenGLExample PROPERTIES COMPILE_FLAGS "/W4 /wd4127")
|
SET_TARGET_PROPERTIES(OpenGLExample PROPERTIES COMPILE_FLAGS "/W4 /wd4127")
|
||||||
ENDIF(MSVC)
|
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")
|
SET_PROPERTY(TARGET OpenGLExample PROPERTY FOLDER "Examples")
|
||||||
|
|
||||||
#Install - Only install the example in Windows
|
#Install - Only install the example in Windows
|
||||||
|
@ -34,17 +34,13 @@ SET(INC_FILES
|
|||||||
Perlin.h
|
Perlin.h
|
||||||
)
|
)
|
||||||
|
|
||||||
add_definitions(-DGLEW_STATIC)
|
|
||||||
|
|
||||||
#"Sources" and "Headers" are the group names in Visual Studio.
|
#"Sources" and "Headers" are the group names in Visual Studio.
|
||||||
#They may have other uses too...
|
#They may have other uses too...
|
||||||
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(OpenGL REQUIRED)
|
|
||||||
|
|
||||||
#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(${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
|
#This will include the shader files inside the compiled binary
|
||||||
QT5_ADD_RESOURCES(COMMON_RESOURCES_RCC ../common/example.qrc)
|
QT5_ADD_RESOURCES(COMMON_RESOURCES_RCC ../common/example.qrc)
|
||||||
@ -57,7 +53,7 @@ ADD_EXECUTABLE(PagingExample ${SRC_FILES} ${COMMON_RESOURCES_RCC})
|
|||||||
IF(MSVC)
|
IF(MSVC)
|
||||||
SET_TARGET_PROPERTIES(PagingExample PROPERTIES COMPILE_FLAGS "/W4 /wd4127")
|
SET_TARGET_PROPERTIES(PagingExample PROPERTIES COMPILE_FLAGS "/W4 /wd4127")
|
||||||
ENDIF(MSVC)
|
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")
|
SET_PROPERTY(TARGET PagingExample PROPERTY FOLDER "Examples")
|
||||||
|
|
||||||
#Install - Only install the example in Windows
|
#Install - Only install the example in Windows
|
||||||
|
@ -32,17 +32,13 @@ SET(INC_FILES
|
|||||||
../common/OpenGLWidget.h
|
../common/OpenGLWidget.h
|
||||||
)
|
)
|
||||||
|
|
||||||
add_definitions(-DGLEW_STATIC)
|
|
||||||
|
|
||||||
#"Sources" and "Headers" are the group names in Visual Studio.
|
#"Sources" and "Headers" are the group names in Visual Studio.
|
||||||
#They may have other uses too...
|
#They may have other uses too...
|
||||||
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(OpenGL REQUIRED)
|
|
||||||
|
|
||||||
#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(${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
|
#This will include the shader files inside the compiled binary
|
||||||
QT5_ADD_RESOURCES(COMMON_RESOURCES_RCC ../common/example.qrc)
|
QT5_ADD_RESOURCES(COMMON_RESOURCES_RCC ../common/example.qrc)
|
||||||
@ -55,7 +51,7 @@ ADD_EXECUTABLE(SmoothLODExample ${SRC_FILES} ${COMMON_RESOURCES_RCC})
|
|||||||
IF(MSVC)
|
IF(MSVC)
|
||||||
SET_TARGET_PROPERTIES(SmoothLODExample PROPERTIES COMPILE_FLAGS "/W4 /wd4127") #All warnings
|
SET_TARGET_PROPERTIES(SmoothLODExample PROPERTIES COMPILE_FLAGS "/W4 /wd4127") #All warnings
|
||||||
ENDIF(MSVC)
|
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")
|
SET_PROPERTY(TARGET SmoothLODExample PROPERTY FOLDER "Examples")
|
||||||
|
|
||||||
#Install - Only install the example in Windows
|
#Install - Only install the example in Windows
|
||||||
|
@ -19,13 +19,11 @@
|
|||||||
# 3. This notice may not be removed or altered from any source
|
# 3. This notice may not be removed or altered from any source
|
||||||
# distribution.
|
# distribution.
|
||||||
|
|
||||||
project(GLEW)
|
#project(GLEW)
|
||||||
|
|
||||||
set(SRC_FILES ../common/glew/glew.cpp)
|
#set(SRC_FILES ../common/glew/glew.cpp)
|
||||||
|
|
||||||
add_definitions(-DGLEW_STATIC)
|
|
||||||
|
|
||||||
#find_package(OpenGL REQUIRED)
|
#find_package(OpenGL REQUIRED)
|
||||||
#include_directories(${OPENGL_INCLUDE_DIR})
|
#include_directories(${OPENGL_INCLUDE_DIR})
|
||||||
add_library(glew STATIC ${SRC_FILES})
|
#add_library(glew STATIC ${SRC_FILES})
|
||||||
SET_PROPERTY(TARGET glew PROPERTY FOLDER "Examples/Common")
|
#SET_PROPERTY(TARGET glew PROPERTY FOLDER "Examples/Common")
|
||||||
|
@ -61,11 +61,10 @@ void OpenGLWidget::mouseMoveEvent(QMouseEvent* event)
|
|||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
void OpenGLWidget::initializeGL()
|
void OpenGLWidget::initializeGL()
|
||||||
{
|
{
|
||||||
GLenum err = glewInit();
|
if (!initializeOpenGLFunctions())
|
||||||
if (GLEW_OK != err)
|
|
||||||
{
|
{
|
||||||
/* Problem: glewInit failed, something is seriously wrong. */
|
std::cerr << "Could not initialize OpenGL functions" << std::endl;
|
||||||
std::cout << "GLEW Error: " << glewGetErrorString(err) << std::endl;
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Print out some information about the OpenGL implementation.
|
//Print out some information about the OpenGL implementation.
|
||||||
|
@ -26,10 +26,12 @@ distribution.
|
|||||||
|
|
||||||
#include "PolyVox/Mesh.h"
|
#include "PolyVox/Mesh.h"
|
||||||
|
|
||||||
#include "glew/glew.h"
|
#include <QOpenGLFunctions_3_1>
|
||||||
|
|
||||||
#include <QGLWidget>
|
#include <QGLWidget>
|
||||||
#include <QGLShaderProgram>
|
#include <QGLShaderProgram>
|
||||||
|
#include <QOpenGLVertexArrayObject>
|
||||||
|
#include <QOpenGLBuffer>
|
||||||
|
|
||||||
// This structure holds all the data required
|
// This structure holds all the data required
|
||||||
// to render one of our meshes through OpenGL.
|
// 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
|
// 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)
|
// 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.
|
// 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:
|
public:
|
||||||
// Constructor
|
// Constructor
|
||||||
|
Loading…
x
Reference in New Issue
Block a user