From 487bf12fa7d31067be7fcf91ec6a882d28f7aceb Mon Sep 17 00:00:00 2001 From: Dmitri K Date: Wed, 9 Nov 2016 20:10:09 -0500 Subject: [PATCH] completing skybox --- src/shaders/skyboxshader.frag | 2 +- src/viewer/simpleViewer.cpp | 30 ++++++++++++++---------------- 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/src/shaders/skyboxshader.frag b/src/shaders/skyboxshader.frag index 6d1e725..053285a 100644 --- a/src/shaders/skyboxshader.frag +++ b/src/shaders/skyboxshader.frag @@ -7,5 +7,5 @@ uniform sampler2D skybox; void main() { //fColor = texture(skybox, texCoords); - fColor = texture(skybox, texCoords); + fColor = texture(skybox, texCoords); } diff --git a/src/viewer/simpleViewer.cpp b/src/viewer/simpleViewer.cpp index f5a1949..aef7cbf 100644 --- a/src/viewer/simpleViewer.cpp +++ b/src/viewer/simpleViewer.cpp @@ -315,8 +315,8 @@ void Viewer::initShaders() if ((s_vUvLocation = skyboxRenderShaderProgram->attributeLocation("vUv")) < 0) qDebug() << "Unable to find shader location for " << "vUv"; - s_texture = new QOpenGLTexture(QImage("src/data/skybox.jpg")); - //s_texture = new QOpenGLTexture(QImage("src/data/uvLayoutGrid.png")); + s_texture = new QOpenGLTexture(QImage("src/data/skybox.jpg"));/*/ + s_texture = new QOpenGLTexture(QImage("src/data/uvLayoutGrid.png"));//*/ s_texture->setMinificationFilter(QOpenGLTexture::LinearMipMapLinear); s_texture->setMagnificationFilter(QOpenGLTexture::Linear); } @@ -358,27 +358,25 @@ void Viewer::initGeometries() { 0.5, -0.5, -0.5 }, { -0.5, -0.5, 0.5 }, { -0.5, -0.5, -0.5 } }; - float ux = 0; - float vy = 0; GLfloat uvs[numVerticesCube][2] = { - { 0, 0}, { 0, 0}, { 0, 0}, - { 0, 0}, { 0, 0}, { 0, 0}, + { 1.0, .25 }, { 1.0, .50 }, { .75, .50 }, + { .75, .50 }, { .75, .25 }, { 1.0, .25 }, - { .25 + ux, .25 + vy }, { .50 + ux, .25 + vy }, { .50 + ux, .50 + vy }, - { 0, 0}, { 0, 0}, { 0, 0}, + { .25, .25 }, { .50, .25 }, { .50, .50 }, + { .50, .50 }, { .25, .50 }, { .25, .25 }, - { 0, 0}, { 0, 0}, { 0, 0}, - { 0, 0}, { 0, 0}, { 0, 0}, + { .00, .25}, { .25, .25}, { .25, .50}, + { .25, .50}, { .00, .50}, { .00, .25}, - { 0, 0}, { 0, 0}, { 0, 0}, - { 0, 0}, { 0, 0}, { 0, 0}, + { .75, .25}, { .50, .50}, { .50, .25}, + { .50, .50}, { .75, .25}, { .75, .50}, - { 0, 0}, { 0, 0}, { 0, 0}, - { 0, 0}, { 0, 0}, { 0, 0}, + { .25, .00 }, { .49, .00 }, { .49, .25 }, + { .49, .25 }, { .25, .25 }, { .25, .00 }, - { 0, 0}, { 0, 0}, { 0, 0}, - { 0, 0}, { 0, 0}, { 0, 0}, + { .25, .50 }, { .49, .75 }, { .49, .50 }, + { .49, .75 }, { .25, .50 }, { .25, .75 }, };