Switched to using Qt for loading extensions, instead of GLEW.

This commit is contained in:
David Williams
2015-02-09 23:17:33 +01:00
parent f042584ed5
commit ec80bfe740
8 changed files with 21 additions and 42 deletions

View File

@ -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")

View File

@ -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.

View File

@ -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