Update the BasicExample to use OpenGL 3
The example now uses OpenGL 3 features like Vertex Array Objects and uses no immediate mode stuff. Qt5 is used for some features like matrices and shaders. There is now no dependency on GLEW either.
This commit is contained in:
@ -26,9 +26,12 @@ distribution.
|
||||
|
||||
#include "PolyVoxCore/SurfaceMesh.h"
|
||||
|
||||
#include "glew/glew.h"
|
||||
#include <QOpenGLFunctions_3_1>
|
||||
|
||||
#include <QGLWidget>
|
||||
#include <QOpenGLShaderProgram>
|
||||
#include <QOpenGLVertexArrayObject>
|
||||
#include <QOpenGLBuffer>
|
||||
|
||||
class OpenGLWidget : public QGLWidget
|
||||
{
|
||||
@ -40,8 +43,8 @@ public:
|
||||
void mouseMoveEvent(QMouseEvent* event);
|
||||
void mousePressEvent(QMouseEvent* event);
|
||||
|
||||
//Convert a SrfaceMesh to OpenGL index/vertex buffers
|
||||
void setSurfaceMeshToRender(const PolyVox::SurfaceMesh<PolyVox::PositionMaterialNormal>& surfaceMesh);
|
||||
//Convert a SurfaceMesh to OpenGL index/vertex buffers
|
||||
void setSurfaceMeshToRender(const PolyVox::SurfaceMesh<PolyVox::PositionMaterial>& surfaceMesh);
|
||||
|
||||
protected:
|
||||
//Qt OpenGL functions
|
||||
@ -51,11 +54,13 @@ protected:
|
||||
|
||||
private:
|
||||
//Index/vertex buffer data
|
||||
GLuint m_uBeginIndex;
|
||||
GLuint m_uEndIndex;
|
||||
GLuint noOfIndices;
|
||||
GLuint indexBuffer;
|
||||
GLuint vertexBuffer;
|
||||
GLuint vertexArrayObject;
|
||||
|
||||
QOpenGLShaderProgram shader;
|
||||
QOpenGLFunctions_3_1* gl;
|
||||
|
||||
//Mouse data
|
||||
QPoint m_LastFrameMousePos;
|
||||
|
Reference in New Issue
Block a user