Hello WebGL

Goals

  • Understand the basic concept of rendering graphics using WebGL.
  • Get the development environment set up and running.
  • Render one triangle on the screen using WebGL.

Introduction

Material

Slides

Assignment 00

Insights

  • A quite recent discussion on Bluesky about downgrading from D3D12 to 11 due to the complexity of the API and the need for a more straightforward approach to graphics programming.
  • You can add the code line /** @type {WebGLRenderingContext} */ over the gl variable declaration in your JavaScript file to get better code completion and error checking for WebGL in your code editor.

Assignment 01

Use the repository from above 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)

Questions

  • TBD