blobt 5 years ago
parent
commit
2417b169c8
  1. BIN
      .vs/shader/v14/.suo
  2. 2
      model.cpp
  3. BIN
      shader.VC.db
  4. 4
      shader.cpp

BIN
.vs/shader/v14/.suo

2
model.cpp

@ -112,7 +112,9 @@ void Model::Init(const char*modelPath) {
void Model::Draw(glm::mat4 & viewMatrix, glm::mat4 projectionMatrix) {
glEnable(GL_DEPTH_TEST);
mVertexBuffer->Bind();
glm::mat4 it = glm::inverseTranspose(mModelMatrix);
mShader->Bind(glm::value_ptr(mModelMatrix), glm::value_ptr(viewMatrix), glm::value_ptr(projectionMatrix));
glUniformMatrix4fv(glGetUniformLocation(mShader->mProgram, "IT_ModelMatrix"), 1, GL_FALSE, glm::value_ptr(it));
glDrawArrays(GL_TRIANGLES, 0, mVertexBuffer->mVertexCount);
mVertexBuffer->Unbind();
}

BIN
shader.VC.db

4
shader.cpp

@ -42,7 +42,9 @@ void Shader::Bind(float *M, float *V, float*P) {
glBindTexture(GL_TEXTURE_2D, iter->second->mTexture);
glUniform1i(iter->second->mLocation, iIndex++);
}
for (auto iter = mUniformVec4s.begin(); iter != mUniformVec4s.end(); ++iter) {
glUniform4fv(iter->second->mLocation, 1, iter->second->v);
}
glEnableVertexAttribArray(mPositionLocation);
glVertexAttribPointer(mPositionLocation, 4, GL_FLOAT, GL_FALSE, sizeof(Vertex), 0);

Loading…
Cancel
Save