I just started to study openGL and I wrote this "Hello World" program to draw a triangle.
#include <GLFW/glfw3.h>
int main(void)
{
GLFWwindow* window;
/* Initialize the library */
if (!glfwInit())
return -1;
/* Create a windowed mode window and its OpenGL context */
window = glfwCreateWindow(640, 640, "Hello World", NULL, NULL);
if (!window)
{
glfwTerminate();
return -1;
}
/* Make the window's context current */
glfwMakeContextCurrent(window);
/* Loop until the user closes th e window */
while (!glfwWindowShouldClose(window))
{
/* Render here */
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_TRIANGLES);
glVertex2f(-0.5f, -0.5f);
glVertex2f( 0.0f, 0.5f);
glVertex2f( 0.5f, -0.5f);
glEnd();
/* Swap front and back buffers */
glfwSwapBuffers(window);
/* Poll for and process events */
glfwPollEvents();
}
glfwTerminate();
return 0;
}
The problem is that I don't like the output since it seems to not match the resolution of my screen. The following pictures compare the output that I obtain by running the code above and a replica that I draw using inkscape.
As you can see, the diagonal edges of the triangle generated with openGL are not as smooth as the ones of the triangle generated with inkscape. I'm wonder if there is a way to fix this problem. Note that I'm an absolute beginner, so that I'm not so much interested in the solution, but rather I just want to know if in the future I will be able to fix the problem.

