Hello.

I want to draw a Square on my OpenGL application.

So, If I have the X,Y coordinates of the top-left vertex and the lenght of the sides (which are all the same for a square),with a very simple mathI can find the other vertices in the 2D space.

Code :// Vertex is a simple struct with a constructor taking 2 arguments: X and Y of the vertex // In this case I set the topLeft vertex to have [COLOR="#FF0000"]X = 0[/COLOR], [COLOR="#008000"]Y = 0.5f[/COLOR] Vertex topLeft{ 0.0f, 0.5f }; //side is the lenght of the square's sides GLfloat side = 0.5f; // DrawTriangle is a function that takes 3 vertices (each of those has a x,y coordinate) and draws them on the application // 1st argument: the topLeft vertex that we've already created // 2nd and 3rd agument: the other two vertices DrawTriangle(window, topLeft, Vertex{ topLeft.x + side, topLeft.y }, Vertex{ topLeft.x + side, topLeft.y - side });

This code will drawhalf square. But not exactly as I expected.

This is the result: (attachment)

Now let's draw the other half square:

Code :DrawTriangle(window, topLeft, Vertex{ topLeft.x, topLeft.y - side }, Vertex{ topLeft.x + side, topLeft.y - side });

Aaaand, the result is rectangle, not a square

Is my math wrong?