GPU management

We will be using OpenGL to render using the GPU. This involves using GL objects to upload data and then process it.

Once you are familiar with the OpenGL commands, describe what each OpenGL command does. Commands dealing with shader attribute inputs have been filled in for you.

  1. The render state must first be prepared. This setup only needs to be done once. The basic setup sequence is:
    1. glGetAttribLocation
      Gets a handle to a shader input slot (i.e. an input port to a GPU-side program)
    2. glGenBuffers
    3. glBindBuffer
    4. glBufferData
  2. Once setup is complete, the data can be rendered. This is done once for each image frame that needs to be generated. The basic render sequence is:
    1. glEnableVertexAttribArray
      Activates a shader input slot, so it can receive data from a GPU memory array
    2. glBindBuffer
    3. glVertexAttribPointer
    4. glDrawArrays