mirror of
https://github.com/ConjureETS/LOG750-LAB2.git
synced 2026-03-25 12:01:21 +00:00
GREAT SCOTT
This commit is contained in:
parent
eb4386ef23
commit
1e0224ee52
@ -47,12 +47,10 @@ namespace
|
|||||||
const double inc_offset = 1.05;
|
const double inc_offset = 1.05;
|
||||||
|
|
||||||
enum Buffer_IDs { ArrayBuffer, NumBuffers };
|
enum Buffer_IDs { ArrayBuffer, NumBuffers };
|
||||||
int vUVLocation;
|
|
||||||
|
|
||||||
GLuint Buffers[NumBuffers];
|
GLuint Buffers[NumBuffers];
|
||||||
|
|
||||||
int m_lDirectionLocation;
|
int m_lDirectionLocation;
|
||||||
int m_vNormalLocation;
|
|
||||||
int m_normalMatrixLoc;
|
int m_normalMatrixLoc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -311,7 +309,6 @@ void Viewer::initShaders()
|
|||||||
}
|
}
|
||||||
|
|
||||||
skyboxRenderShaderProgram->link();
|
skyboxRenderShaderProgram->link();
|
||||||
skyboxRenderShaderProgram->bind();
|
|
||||||
|
|
||||||
// if ((s_texCoordsLocation = m_program->attributeLocation("texCoords")) < 0)
|
// if ((s_texCoordsLocation = m_program->attributeLocation("texCoords")) < 0)
|
||||||
// qDebug() << "Unable to find shader location for " << "vPosition";
|
// qDebug() << "Unable to find shader location for " << "vPosition";
|
||||||
@ -417,9 +414,9 @@ void Viewer::initGeometries()
|
|||||||
|
|
||||||
|
|
||||||
glBindVertexArray(m_VAOs[VAO_Cube]);
|
glBindVertexArray(m_VAOs[VAO_Cube]);
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, m_Buffers[VBO_Cube]);
|
// glBindBuffer(GL_ARRAY_BUFFER, m_Buffers[VBO_Cube]);
|
||||||
glGenBuffers(NumBuffers, Buffers);
|
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),
|
glBufferData(GL_ARRAY_BUFFER, sizeof(verticesCube) + sizeof(uvs) + sizeof(normals),
|
||||||
NULL, GL_STATIC_DRAW);
|
NULL, GL_STATIC_DRAW);
|
||||||
glBufferSubData(GL_ARRAY_BUFFER, 0, sizeof(verticesCube), verticesCube);
|
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));
|
glVertexAttribPointer(m_vPositionLocation, 3, GL_FLOAT, GL_FALSE, 0, BUFFER_OFFSET(0));
|
||||||
glEnableVertexAttribArray(m_vPositionLocation);
|
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,
|
glVertexAttribPointer(m_vNormalLocation, 3, GL_FLOAT,
|
||||||
GL_TRUE, 0, BUFFER_OFFSET(sizeof(verticesCube) + sizeof(uvs)));
|
GL_TRUE, 0, BUFFER_OFFSET(sizeof(verticesCube) + sizeof(uvs)));
|
||||||
glEnableVertexAttribArray(m_vNormalLocation);
|
glEnableVertexAttribArray(m_vNormalLocation);
|
||||||
|
|
||||||
|
glVertexAttribPointer(s_vUvLocation, 2, GL_FLOAT,
|
||||||
|
GL_FALSE, 0, BUFFER_OFFSET(sizeof(verticesCube)));
|
||||||
|
glEnableVertexAttribArray(s_vUvLocation);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Viewer::visit(Cube &s)
|
void Viewer::visit(Cube &s)
|
||||||
|
|||||||
@ -91,6 +91,7 @@ private:
|
|||||||
int s_projMatrixLocation;
|
int s_projMatrixLocation;
|
||||||
int s_skyboxCubemapLocation;
|
int s_skyboxCubemapLocation;
|
||||||
int s_vUvLocation;
|
int s_vUvLocation;
|
||||||
|
int m_vNormalLocation;
|
||||||
|
|
||||||
QOpenGLTexture *s_texture;
|
QOpenGLTexture *s_texture;
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user