Hello Triangle
The objectives of this TP are:
- Making first contact with the OpenGL API, the GLSL shader language and the rendering pipeline
- Understanding the basics of the OpenGL coordinate systems
- Learning to pass data from the CPU to the GPU code and understand shader
- Code your first Hello Triangle
What is OpenGL?
OpenGL, short for "Open Graphics Library," is an application programming interface (API) designed for rendering 2D and 3D graphics. It provides a common set of commands that can be used to manage graphics in different applications and on multiple platforms.
The OpenGL pipeline can be summarized as follows,
GL Pipeline
Build and Run
Refer to tutorial 1. and 2. from https://www.opengl-tutorial.org/fr/beginners-tutorials/tutorial-1-opening-a-window/ to learn how to compile, build and run project on your OS.
Skeleton Code
Let's make your first triangle in OpenGL. Clone or fork the project from the course gitlab page https://gitlab.inria.fr/aviz/cg_intro_public.git.
Apart from the classes(Viewer, Triangle and Shader), the skeleton contains the following two shaders:
Take an in-depth look at the skeleton code and uncomment the line which adds the triangle to the viewer. You should get the following output.
Hello Triangle
Try to modify the shape and color of the triangle. What changes did you make?