I simply began to check openGL and I wrote this “Hey World” program to attract a triangle.
#embody
int important(void)
{
GLFWwindow* window;
/* Initialize the library */
if (!glfwInit())
return -1;
/* Create a windowed mode window and its OpenGL context */
window = glfwCreateWindow(640, 640, "Hey World", NULL, NULL);
if (!window)
{
glfwTerminate();
return -1;
}
/* Make the window's context present */
glfwMakeContextCurrent(window);
/* Loop till the person closes th e window */
whereas (!glfwWindowShouldClose(window))
{
/* Render right 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 back and front buffers */
glfwSwapBuffers(window);
/* Ballot for and course of occasions */
glfwPollEvents();
}
glfwTerminate();
return 0;
}
The issue is that I do not just like the output because it appears to not match the decision of my display. The next photos evaluate the output that I receive by operating the code above and a reproduction that I draw utilizing inkscape.
As you may see, the diagonal edges of the triangle generated with openGL should not as clean as those of the triangle generated with inkscape. I am surprise if there’s a approach to repair this drawback. Be aware that I am an absolute newbie, in order that I am not a lot within the answer, however moderately I simply wish to know if sooner or later I will repair the issue.