mirror of
https://github.com/ConjureETS/LOG750-LAB2.git
synced 2026-03-24 03:21:19 +00:00
working on texturing
This commit is contained in:
parent
104038d7f6
commit
a883722d25
Binary file not shown.
|
Before Width: | Height: | Size: 352 KiB After Width: | Height: | Size: 431 KiB |
BIN
src/data/uvLayoutGrid.png
Normal file
BIN
src/data/uvLayoutGrid.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 858 KiB |
@ -7,5 +7,5 @@ uniform sampler2D skybox;
|
|||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
//fColor = texture(skybox, texCoords);
|
//fColor = texture(skybox, texCoords);
|
||||||
fColor = vec4(1.0, 0, 1.0, 1.0);// * texture(skybox, texCoords);
|
fColor = texture(skybox, texCoords);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -228,6 +228,8 @@ void Viewer::init()
|
|||||||
|
|
||||||
void Viewer::initShaders()
|
void Viewer::initShaders()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
// Load vertex and fragment shaders
|
// Load vertex and fragment shaders
|
||||||
m_program = new QOpenGLShaderProgram;
|
m_program = new QOpenGLShaderProgram;
|
||||||
colorPickerShaderProgram = m_program;
|
colorPickerShaderProgram = m_program;
|
||||||
@ -313,7 +315,8 @@ void Viewer::initShaders()
|
|||||||
if ((s_vUvLocation = skyboxRenderShaderProgram->attributeLocation("vUv")) < 0)
|
if ((s_vUvLocation = skyboxRenderShaderProgram->attributeLocation("vUv")) < 0)
|
||||||
qDebug() << "Unable to find shader location for " << "vUv";
|
qDebug() << "Unable to find shader location for " << "vUv";
|
||||||
|
|
||||||
s_texture = new QOpenGLTexture(QImage("src/data/skybox.jpg").mirrored());
|
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->setMinificationFilter(QOpenGLTexture::LinearMipMapLinear);
|
||||||
s_texture->setMagnificationFilter(QOpenGLTexture::Linear);
|
s_texture->setMagnificationFilter(QOpenGLTexture::Linear);
|
||||||
}
|
}
|
||||||
@ -355,25 +358,28 @@ void Viewer::initGeometries()
|
|||||||
{ 0.5, -0.5, -0.5 }, { -0.5, -0.5, 0.5 }, { -0.5, -0.5, -0.5 }
|
{ 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] = {
|
||||||
|
|
||||||
GLfloat uvs[numVerticesCube][2] = {
|
{ 0, 0}, { 0, 0}, { 0, 0},
|
||||||
{ 0, 0 }, { 1, 0 }, { 0, 1 },
|
{ 0, 0}, { 0, 0}, { 0, 0},
|
||||||
{ 1, 1 }, { 0, 0 }, { 1, 0 },
|
|
||||||
|
|
||||||
{ 0, 0 }, { 1, 0 }, { 0, 1 },
|
{ .25 + ux, .25 + vy }, { .50 + ux, .25 + vy }, { .50 + ux, .50 + vy },
|
||||||
{ 1, 1 }, { 0, 0 }, { 1, 0 },
|
{ 0, 0}, { 0, 0}, { 0, 0},
|
||||||
|
|
||||||
{ 0, 0 }, { 1, 0 }, { 0, 1 },
|
{ 0, 0}, { 0, 0}, { 0, 0},
|
||||||
{ 1, 1 }, { 0, 0 }, { 1, 0 },
|
{ 0, 0}, { 0, 0}, { 0, 0},
|
||||||
|
|
||||||
{ 0, 0 }, { 1, 0 }, { 0, 1 },
|
{ 0, 0}, { 0, 0}, { 0, 0},
|
||||||
{ 1, 1 }, { 0, 0 }, { 1, 0 },
|
{ 0, 0}, { 0, 0}, { 0, 0},
|
||||||
|
|
||||||
{ 0, 0 }, { 1, 0 }, { 0, 1 },
|
{ 0, 0}, { 0, 0}, { 0, 0},
|
||||||
{ 1, 1 }, { 0, 0 }, { 1, 0 },
|
{ 0, 0}, { 0, 0}, { 0, 0},
|
||||||
|
|
||||||
|
{ 0, 0}, { 0, 0}, { 0, 0},
|
||||||
|
{ 0, 0}, { 0, 0}, { 0, 0},
|
||||||
|
|
||||||
{ 0, 0 }, { 1, 0 }, { 0, 1 },
|
|
||||||
{ 1, 1 }, { 0, 0 }, { 1, 0 },
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user