From da52327de56b5fe5fe213bd25452759dc91b8be0 Mon Sep 17 00:00:00 2001 From: Riku Avelar Date: Wed, 9 Nov 2016 17:58:45 -0500 Subject: [PATCH] Add missing UVs (still missing?) --- src/viewer/simpleViewer.cpp | 9 ++++++++- src/viewer/simpleViewer.h | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/viewer/simpleViewer.cpp b/src/viewer/simpleViewer.cpp index 56de167..b0f93e9 100644 --- a/src/viewer/simpleViewer.cpp +++ b/src/viewer/simpleViewer.cpp @@ -93,7 +93,7 @@ void Viewer::drawSkybox() // Increase size of skybox - modelViewMatrix.scale(300); + modelViewMatrix.scale(1); skyboxRenderShaderProgram->setUniformValue(s_projMatrixLocation, projectionMatrix); skyboxRenderShaderProgram->setUniformValue(s_mvMatrixLocation, modelViewMatrix); @@ -302,6 +302,9 @@ void Viewer::initShaders() if ((s_mvMatrixLocation = skyboxRenderShaderProgram->uniformLocation("mvMatrix")) < 0) qDebug() << "Unable to find shader location for " << "mvMatrix"; + if ((s_vUvLocation = skyboxRenderShaderProgram->attributeLocation("vUv")) < 0) + qDebug() << "Unable to find shader location for " << "vUv"; + s_texture = new QOpenGLTexture(QImage("src/data/skybox.jpg").mirrored()); s_texture->setMinificationFilter(QOpenGLTexture::LinearMipMapLinear); s_texture->setMagnificationFilter(QOpenGLTexture::Linear); @@ -382,6 +385,10 @@ 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); } void Viewer::visit(Cube &s) diff --git a/src/viewer/simpleViewer.h b/src/viewer/simpleViewer.h index 734c0ae..0451a39 100644 --- a/src/viewer/simpleViewer.h +++ b/src/viewer/simpleViewer.h @@ -90,7 +90,7 @@ private: int s_colorLocation; int s_projMatrixLocation; int s_skyboxCubemapLocation; - int s_vUv; + int s_vUvLocation; QOpenGLTexture *s_texture;