Code:
//***************** IMPORTANT NPTE ****************************
//
//To do glut make sure you have glut32.lib and opengl32.lib are inserted
//in the project as files. Also make sure glut.h is also in the inculde
//file under Tools->option path. Also glut32.dll is in the windows/system
//directory
#include <stdio.h>
#include <glut.h>
#include <windows.h>
void display(void)
{
glClear( GL_COLOR_BUFFER_BIT);
glColor3f(0.0, 1.0, 0.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glRotatef(-30.0, 1, 0, 0);
glRotatef(-30.0, 0, 1, 0);
glTranslatef(0, 0, 0);
//glutWireCube(2.0);
glVertex3f(2.0, 4.0, 0.0);
glVertex3f(8.0, 4.0, 0.0);
glVertex3f(8.0, 6.0, 0.0);
glVertex3f(2.0, 6.0, 0.0);
glEnd();
glFlush();
}
int main(int argc, char **argv)
{
printf("hello world\n");
glutInit(&argc, argv);
glutInitDisplayMode ( GLUT_SINGLE | GLUT_RGB | GLUT_DEPTH);
glutInitWindowPosition(100,100);
glutInitWindowSize(300,300);
glutCreateWindow ("square");
glClearColor(0,0,0,0);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-5.0, 5.0, -5.0, 5.0, 5.0, -5.0);
glutDisplayFunc(display);
glutMainLoop();
return 0;
}