Load Box_normal model in main()
main.cpp
Define the normal map shader global variable
GLuint blinnShader;
GLuint phongShader;
GLuint texblinnShader;
// LabA08 Normal map
GLuint normalmapShader;Init the normal map shader in main()
normalmapShader = initShader("shaders/normalmap.vert", "shaders/normalmap.frag");
setLightPosition(lightPos);
setViewPosition(viewPos);Load the Box_normal model
std::shared_ptr<Mesh> box = std::make_shared<Mesh>();
box->init("models/Box_normal.obj", normalmapShader);Draw the model
while (!glfwWindowShouldClose(window))
{
glfwPollEvents();
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
// for LabA08 Normal Map
box->draw(matModelRoot, matView, matProj);
glfwSwapBuffers(window);
}
Last updated