3.1.5 Use class Mesh to Draw a Model

in main.cpp

in main.cpp, first include mesh.h

Add a function initShader()

Call initShader() and new a Mesh object in main()

comment out initTriangle(), add the following before that

initShader()

new a Mesh

After that new a Mesh objet and use it to load your model.

You need to use your own path of your model.

Call pMesh->draw()

In the main GLFW rendering loop, replace drawTriangle() with Mesh::draw()

Now you are going to see a teapot like this

Full Source Code

Last updated