Labs /

TP-1


Class Organization

Labs

* TP-5?

Gallery of Past Projects

Lab Sessions * Lab Sessions Overview * Assignments * Raytracing project * OpenGL project * Polytech Extension * Gallery

percent right percent edit SideBar

TP-1

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:

  • color.vert
  • color.frag

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?

Recent Changes (All) | Edit SideBar Page last modified on February 28, 2025, at 08:05 AM Edit Page | Page History
Powered by PmWiki