Screenshot This code compiles without errors or warning, but it can't run it, application crashing instantly.
#include <GL/glut.h>
int WinWidth = 640,
WinHeight = 480;
int WinFar = 10;
void DrawPoint(float x, float y)
{
glColor3f(1.0, 1.0, 1.0);
glBegin(GL_POINTS);
glVertex2f(x, y);
glEnd();
}
void display()
{
glClear(GL_COLOR_BUFFER_BIT);
//Draws
DrawPoint(0, 0);
//
glFlush();
}
int main(int argc, char** argv)
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
glutInitWindowSize(WinWidth, WinHeight);
glutInitWindowPosition(150, 150);
glutCreateWindow("Lesson 01");
glClearColor(0, 0, 0, 1.0);
glOrtho(-WinWidth/2, WinWidth/2, WinHeight/2, -WinHeight/2, -WinFar/2, WinFar/2);
glutDisplayFunc(display);
glutMainLoop();
return 0;
}
It's crashing with return value 3221225477. What I'm doing wrong?
Program received signal SIGEGV, Segmentation fault when I run it in debug mode