The Rendering Pipeline

Goals

Render one triangle on the screen using WebGL.

Assignment

Use the repository from last time and follow the instructions in the slides:

eyes eyes means that the code is already in the repository and you just need to look at it.

clipboard clipboard means you can copy-paste the code and it should work.

memo memo means that you need to create a new file

o o indicates that you need to do more than just copy-paste the code.

In any case you need to understand what you are doing.

Material

Tasks (for the “Hello WebGL” demo)

In the following, some tasks are listed that need to be implemented in order to better understand the implemented code.

Simple

(small and easy code changes)

  • Change the size of the triangle
  • Change the color of the triangle
  • Change the color of the background

Complex

(needs new functions)

Tasks (for the “Hello 3D” demo)

In the following, some tasks are listed that need to be implemented in order to better understand the implemented code.

Simple

(small and easy code changes)

  • Change the size of the triangles
  • Change the color of the triangles
  • Change the color of the background

Complex

(needs new functions)

  • Render the triangles as points (check webgl-points-lines-triangles for help)
  • Render the triangles as lines (check webgl-points-lines-triangles for help)
  • Change the perspective of the camera (check webgl-camera for help)
  • Change the second parameter in the gl.uniformMatrix4fv(modelMatrixLocation, false, modelViewMatrix); function call to true and check the result.
  • Draw one thousand triangles instead of two.

Insights