Hello OpenGL

In this task we will be using GLFW and pre version 3 OpenGL. GLFW is a lightweight utility library for use with OpenGL. It provides programmers with the ability to create and manage windows and OpenGL contexts, as well as receive input from joystick, keyboard, mouse, time and clipboard. The base code comes with a Codeblocks project.

In the following link you can find a simple base code for the task at hand:

https://cglearn.codelight.eu/files/course/1/tasks/HelloOpenGL.zip

The task itself is to draw an equilateral triangle in a specific position. In the base code you can find a function drawTriangle(x, y) that is unfinished. The task is to finish it. The final result should look something like the image on the right.

You can choose the size and color of the triangle yourself. Main requirement is that it is a equilateral (all of the sides have the same length) and the center of the triangle is positioned at the coordinates given to the function.

Do not forget to account for the aspect ratio, because here our coordinate space is not uniform (1 unit in x direction is generally not the same amount as 1 unit in y).

 
;