Load the Bunny in main()

main.cpp

texblinnShader Global variable in main.cpp

Declare texblinnShader before main()

GLuint blinnShader;
GLuint phongShader;
// added for LabA07
GLuint texblinnShader;

Init texblinnShader in main()

    ...
    phongShader = initShader( "shaders/blinn.vert", "shaders/phong.frag");
    ...
    blinnShader = initShader( "shaders/blinn.vert", "shaders/blinn.frag");
    ...
    
    // added for LabA07
    texblinnShader = initShader("shaders/texblinn.vert", "shaders/texblinn.frag");
    setLightPosition(lightPos);
    setViewPosition(viewPos);

Add Bunny to the scene

New a Bunny mesh

Draw the Bunny

You can directly draw the bunny mesh or add it to a scene graph

Route 1 : Directly draw the bunny mesh

Route 2: Simple Scene Graph

Add the Bunny mesh to a Bunny node

Because the bunny model has a size of about 500x500x500, here we are resizing it to about 2.5x2.5x2.5

Add the Bunny node to the scene

Draw the Scene

Route 3: Hierarchical Scene Graph, for example

Full Source Code of main.cpp

Last updated