From 1e0224ee523c3393be728d0f8cc700cce6b5bdac Mon Sep 17 00:00:00 2001 From: Riku Avelar Date: Wed, 9 Nov 2016 21:29:44 -0500 Subject: [PATCH] GREAT SCOTT --- src/viewer/simpleViewer.cpp | 15 ++++++--------- src/viewer/simpleViewer.h | 1 + 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/viewer/simpleViewer.cpp b/src/viewer/simpleViewer.cpp index 0cc1feb..3cdaf56 100644 --- a/src/viewer/simpleViewer.cpp +++ b/src/viewer/simpleViewer.cpp @@ -47,12 +47,10 @@ namespace const double inc_offset = 1.05; enum Buffer_IDs { ArrayBuffer, NumBuffers }; - int vUVLocation; GLuint Buffers[NumBuffers]; int m_lDirectionLocation; - int m_vNormalLocation; int m_normalMatrixLoc; } @@ -311,7 +309,6 @@ void Viewer::initShaders() } skyboxRenderShaderProgram->link(); - skyboxRenderShaderProgram->bind(); // if ((s_texCoordsLocation = m_program->attributeLocation("texCoords")) < 0) // qDebug() << "Unable to find shader location for " << "vPosition"; @@ -417,9 +414,9 @@ void Viewer::initGeometries() glBindVertexArray(m_VAOs[VAO_Cube]); - glBindBuffer(GL_ARRAY_BUFFER, m_Buffers[VBO_Cube]); +// glBindBuffer(GL_ARRAY_BUFFER, m_Buffers[VBO_Cube]); glGenBuffers(NumBuffers, Buffers); - glBindBuffer(GL_ARRAY_BUFFER, Buffers[ArrayBuffer]); + glBindBuffer(GL_ARRAY_BUFFER, m_Buffers[VBO_Cube]); glBufferData(GL_ARRAY_BUFFER, sizeof(verticesCube) + sizeof(uvs) + sizeof(normals), NULL, GL_STATIC_DRAW); glBufferSubData(GL_ARRAY_BUFFER, 0, sizeof(verticesCube), verticesCube); @@ -433,13 +430,13 @@ void Viewer::initGeometries() glVertexAttribPointer(m_vPositionLocation, 3, GL_FLOAT, GL_FALSE, 0, BUFFER_OFFSET(0)); glEnableVertexAttribArray(m_vPositionLocation); - glVertexAttribPointer(s_vUvLocation, 2, GL_FLOAT, - GL_FALSE, 0, BUFFER_OFFSET(sizeof(verticesCube))); - glEnableVertexAttribArray(s_vUvLocation); - glVertexAttribPointer(m_vNormalLocation, 3, GL_FLOAT, GL_TRUE, 0, BUFFER_OFFSET(sizeof(verticesCube) + sizeof(uvs))); glEnableVertexAttribArray(m_vNormalLocation); + + glVertexAttribPointer(s_vUvLocation, 2, GL_FLOAT, + GL_FALSE, 0, BUFFER_OFFSET(sizeof(verticesCube))); + glEnableVertexAttribArray(s_vUvLocation); } void Viewer::visit(Cube &s) diff --git a/src/viewer/simpleViewer.h b/src/viewer/simpleViewer.h index 0451a39..80ab402 100644 --- a/src/viewer/simpleViewer.h +++ b/src/viewer/simpleViewer.h @@ -91,6 +91,7 @@ private: int s_projMatrixLocation; int s_skyboxCubemapLocation; int s_vUvLocation; + int m_vNormalLocation; QOpenGLTexture *s_texture;