I want to ask why my code is so big .
When I compile it ,it has 168 kb .
Here is the source code.
#include <windows.h>
#include <GL/gl.h>
#include <GL/glut.h>
#pragma comment(linker,"/entry:âmainCRTStartupâ")
void init(void)
{
glEnable( GL_DEPTH_TEST );
glDepthFunc( GL_LESS );
glClearColor( 0.0, 0.0, 0.0, 0.0 );
glClearDepth( 1 );
glShadeModel( GL_SMOOTH );
}
void display(void)
{
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT );
glLoadIdentity();
glRotatef( 45.0, 1.0, 1.0, 1.0 );
glBegin( GL_QUADS );
// front
glColor3f( 1.0, 0.0, 0.0 );
glVertex3f( 1.0, 1.0, 1.0 );
glVertex3f(-1.0, 1.0, 1.0 );
glVertex3f(-1.0,-1.0, 1.0 );
glVertex3f( 1.0,-1.0, 1.0 );
// back
glVertex3f(-1.0, 1.0,-1.0 );
glVertex3f( 1.0, 1.0,-1.0 );
glVertex3f( 1.0,-1.0,-1.0 );
glVertex3f(-1.0,-1.0,-1.0 );
// left
glColor3f( 0.0, 1.0, 0.0 );
glVertex3f(-1.0, 1.0, 1.0 );
glVertex3f(-1.0, 1.0,-1.0 );
glVertex3f(-1.0,-1.0,-1.0 );
glVertex3f(-1.0,-1.0, 1.0 );
// right
glVertex3f( 1.0, 1.0,-1.0 );
glVertex3f( 1.0, 1.0, 1.0 );
glVertex3f( 1.0,-1.0, 1.0 );
glVertex3f( 1.0,-1.0,-1.0 );
// top
glColor3f( 0.0, 0.0, 1.0 );
glVertex3f( 1.0, 1.0,-1.0 );
glVertex3f(-1.0, 1.0,-1.0 );
glVertex3f(-1.0, 1.0, 1.0 );
glVertex3f( 1.0, 1.0, 1.0 );
// bottom
glVertex3f( 1.0,-1.0, 1.0 );
glVertex3f(-1.0,-1.0, 1.0 );
glVertex3f(-1.0,-1.0,-1.0 );
glVertex3f( 1.0,-1.0,-1.0 );
glEnd();
glutSwapBuffers();
glutPostRedisplay();
}
void reshape( int width,int height )
{
glMatrixMode( GL_PROJECTION );
glLoadIdentity();
gluPerspective( 45.0, (GLdouble)width/(GLdouble)height, 1.0, 50.0 );
glTranslatef( 0.0, 0.0, -10.0 );
glViewport( 0, 0, width, height);
glMatrixMode( GL_MODELVIEW );
}
void main( void )
{
glutInitWindowSize( 600, 512 );
glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH );
glutCreateWindow( "OpenGL" );
glutDisplayFunc( display );
glutReshapeFunc( reshape );
init();
glutMainLoop();
}