#include<GL/glut.h>
#include<GL/glu.h>
#include<GL/gl.h>
#include<math.h>
#include<stdio.h>
#define PI 3.1415926



void DrawGround(){
    GLfloat fExtent = 10.0f;
    GLfloat fStep = 1.0f;
    GLfloat y = -0.4f;
    GLint iLine;
    glColor3f(1.0,1.0,1.0);
    glBegin(GL_LINES);
       for(iLine = -fExtent; iLine <= fExtent; iLine += fStep)
          {
          glVertex3f(iLine, y, fExtent);    // Draw Z lines
          glVertex3f(iLine, y, -fExtent);
    
          glVertex3f(fExtent, y, iLine);
          glVertex3f(-fExtent, y, iLine);
          }
    
    glEnd();
}

void ChangeSize(int w, int h){
	GLfloat fAspect;
    if(h == 0) h = 1;
    glViewport(0, 0, w, h);
    fAspect = (GLfloat)w / (GLfloat)h;
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    gluPerspective(35.0f, fAspect, 1.0f, 40.0f);
    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();
}


void Draw(){
	glClearColor(0.0,0.0,1.0,1.0);
	glClear(GL_COLOR_BUFFER_BIT);
	glPolygonMode(GL_FRONT_AND_BACK,GL_LINE);
	glMatrixMode(GL_MODELVIEW);
	glLoadIdentity();
	glPushMatrix();
	
        
       
        
	DrawGround();
	glBegin(GL_LINES);
	glColor3f(1.0,0.0,0.0);
	glVertex3f(0.0,0.0,0.0);
	glVertex3f(10.0,0.0,0.0);

	glColor3f(0.0,1.0,0.0);
	glVertex3f(0.0,0.0,0.0);
	glVertex3f(0.0,10.0,0.0);

	glColor3f(1.0,1.0,0.0);
	glVertex3f(0.0,0.0,0.0);
	glVertex3f(0.0,0.0,10.0);
	glEnd();
	 glPushMatrix();
	  glTranslatef(5.0,0.0,0.0);
	  glutWireTeapot(0.6f);
	 glPopMatrix();
	glPopMatrix();
	glutSwapBuffers();
}


void SpecialKeys(int key, int x_m, int y_m)
    {
		switch(key){
		case GLUT_KEY_UP:
                          
                                 
				
				 break;
		case GLUT_KEY_DOWN:
			
                               
				 
				 break;
		case GLUT_KEY_LEFT:
                              
				
				break;
		case GLUT_KEY_RIGHT:
				
				
				break;
		}
    glutPostRedisplay();
    }

int main(int argc, char* argv[]){
glutInit(&argc, argv);
	glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB);
	glutInitWindowSize(640,480);
	glutCreateWindow("viewing");
	glutDisplayFunc(Draw);
	glutSpecialFunc(SpecialKeys);
	glutReshapeFunc(ChangeSize);
	glutMainLoop();
	return 0;
}