Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- #include<GL/gl.h>
- #include <GL/glu.h>
- #include <GL/glut.h>
- using namespace std;
- const int window_width = 900;
- const int window_height = 550;
- const float rat = 1.0 * window_width / window_height;
- GLfloat eyeX = 5;
- GLfloat eyeY = 40;
- GLfloat eyeZ = 50;
- GLfloat lookX = 0;
- GLfloat lookY = 40;
- GLfloat lookZ = -100;
- int up=0,down=0,r=0,l=0, sakib =20;
- int light_1 = 0, light_2= 0, light_3 = 0;
- float rot = 0, fan_rt = 0;
- static void getNormal3p(GLfloat x1, GLfloat y1, GLfloat z1, GLfloat x2, GLfloat y2, GLfloat z2, GLfloat x3, GLfloat y3, GLfloat z3)
- {
- GLfloat Ux, Uy, Uz, Vx, Vy, Vz, Nx, Ny, Nz;
- Ux = x2-x1;
- Uy = y2-y1;
- Uz = z2-z1;
- Vx = x3-x1;
- Vy = y3-y1;
- Vz = z3-z1;
- Nx = Uy*Vz - Uz*Vy;
- Ny = Uz*Vx - Ux*Vz;
- Nz = Ux*Vy - Uy*Vx;
- glNormal3f(Nx,Ny,Nz);
- }
- static GLfloat v_cube[8][3] =
- {
- {0,0,0},
- {0,0,1},
- {0,1,0},
- {0,1,1},
- {1,0,0},
- {1,0,1},
- {1,1,0},
- {1,1,1}
- };
- static GLubyte c_ind[6][4] =
- {
- {0,2,6,4},
- {5,7,3,1},
- {0,4,5,1},
- {3,7,6,2},
- {0,1,3,2},
- {6,7,5,4}
- };
- static void resize(int width, int height)
- {
- const float ar = (float) window_width / (float) window_height;
- glViewport(0, 0, window_width, window_height);
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glFrustum(-ar, ar, -1.0, 1.0, 2.0, 100.0);
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity() ;
- }
- void cube(float colR=0.5, float colG=0.5, float colB=0.5)
- {
- GLfloat no_mat[] = { 0.0, 0.0, 0.0, 1.0 };
- GLfloat mat_ambient[] = { colR, colG, colB, 1.0 };
- GLfloat mat_diffuse[] = { colR, colG, colB, 1.0 };
- GLfloat mat_specular[] = { 1.0, 1.0, 1.0, 1.0 };
- //GLfloat mat_emission[] = { 1.0, 1.0, 1.0, 1.0 };
- GLfloat mat_shininess[] = {30};
- glMaterialfv( GL_FRONT, GL_AMBIENT, mat_ambient);
- glMaterialfv( GL_FRONT, GL_DIFFUSE, mat_diffuse);
- glMaterialfv( GL_FRONT, GL_SPECULAR, mat_specular);
- glMaterialfv( GL_FRONT, GL_SHININESS, mat_shininess);
- //glMaterialfv( GL_FRONT, GL_EMISSION, mat_emission);
- glBegin(GL_QUADS);
- for (GLint i = 0; i <6; i++)
- {
- // glColor3f(colR,colG,colB);
- //
- // colR += 0.05;
- // colG += 0.05;
- // colB += 0.05;
- getNormal3p(v_cube[c_ind[i][0]][0], v_cube[c_ind[i][0]][1], v_cube[c_ind[i][0]][2],
- v_cube[c_ind[i][1]][0], v_cube[c_ind[i][1]][1], v_cube[c_ind[i][1]][2],
- v_cube[c_ind[i][2]][0], v_cube[c_ind[i][2]][1], v_cube[c_ind[i][2]][2]);
- for (GLint j=0; j<4; j++)
- {
- glVertex3fv(&v_cube[c_ind[i][j]][0]);
- }
- }
- glEnd();
- }
- void fan_rotation()
- {
- fan_rt = fan_rt+1;
- if(fan_rt>360)
- fan_rt =0;
- glutPostRedisplay();
- }
- void axes()
- {
- float length = 10;
- float width = 0.3;
- // X-axis
- glPushMatrix();
- glTranslatef(length/2,0,0);
- glScalef(length,width,width);
- glTranslatef(-0.5,-0.5,-0.5);
- cube(1,0,0); //RED Line
- glPopMatrix();
- // Y-axis
- glPushMatrix();
- glTranslatef(0,length/2,0);
- glScalef(width,length,width);
- glTranslatef(-0.5,-0.5,-0.5);
- cube(0,1,0); //GREEN Line
- glPopMatrix();
- // Z-axis
- glPushMatrix();
- glTranslatef(0,0,length/2);
- glScalef(width,width,length);
- glTranslatef(-0.5,-0.5,-0.5);
- cube(0,0,1); //BLUE Line
- glPopMatrix();
- }
- void desk()
- {
- float height=6;
- float width=10;
- float length=5;
- float base_height=1;
- float leg_height=height-base_height;
- float leg_width=0.5;
- // whole table
- glPushMatrix();
- glTranslatef(0,leg_height,0);
- // base
- glPushMatrix();
- glScalef(width,base_height,length);
- glTranslatef(-0.5,0,-0.5);
- cube(0.53,0.39,0.28);
- glPopMatrix();
- // legs
- glPushMatrix();
- glTranslatef((width/2-leg_width/2),0,(length/2-leg_width/2));
- glScalef(leg_width,leg_height,leg_width);
- glTranslatef(-0.5,-1,-0.5);
- cube(0.53,0.39,0.28);
- glPopMatrix();
- glPushMatrix();
- glTranslatef((width/2-leg_width/2),0,-(length/2-leg_width/2));
- glScalef(leg_width,leg_height,leg_width);
- glTranslatef(-0.5,-1,-0.5);
- cube(0.53,0.39,0.28);
- glPopMatrix();
- glPushMatrix();
- glTranslatef(-(width/2-leg_width/2),0,(length/2-leg_width/2));
- glScalef(leg_width,leg_height,leg_width);
- glTranslatef(-0.5,-1,-0.5);
- cube(0.53,0.39,0.28);
- glPopMatrix();
- glPushMatrix();
- glTranslatef(-(width/2-leg_width/2),0,-(length/2-leg_width/2));
- glScalef(leg_width,leg_height,leg_width);
- glTranslatef(-0.5,-1,-0.5);
- cube(0.53,0.39,0.28);
- glPopMatrix();
- glPopMatrix();
- }
- void table()
- {
- float top_length = 20;
- float top_width = 10;
- float top_height = 0.3;
- //table-top
- glPushMatrix();
- glTranslatef(0,top_length/2,0);
- glScalef(top_length,top_height,top_width);
- glTranslatef(-0.5,0.0,-0.5);
- cube(0.647, 0.165, 0.165);
- glPopMatrix();
- //side bar
- for(int i=-1; i<=1; i+=2)
- {
- glPushMatrix();
- glTranslatef(i*(top_length/2-3*top_height/2),0,0);
- glScalef(top_height,top_length,top_width);
- glTranslatef(-0.5,-0.5,-0.5);
- cube(0.647, 0.165, 0.165);
- glPopMatrix();
- }
- }
- void chair()
- {
- float seat_length =12, seat_height =2, seat_width =8;
- float leg_length = 0.8, leg_height = 12, leg_width = 0.8;
- //seat
- glPushMatrix();
- glScalef(seat_length,seat_height,seat_width);
- glTranslatef(-0.5,0,-0.5);
- cube(0.000, 0.000, 0.000);
- glPopMatrix();
- //upper-leg(left)
- glPushMatrix();
- glTranslatef(-(seat_length/2-leg_length/2),0,-(seat_width/2-leg_width/2));
- glScalef(leg_length,leg_height,leg_width);
- glTranslatef(-0.5,0,-0.5);
- cube(0.45,0.49,0.28);
- glPopMatrix();
- //upper-leg(right)
- glPushMatrix();
- glTranslatef((seat_length/2-leg_length/2),0,-(seat_width/2-leg_width/2));
- glScalef(leg_length,leg_height,leg_width);
- glTranslatef(-0.5,0,-0.5);
- cube(0.45,0.49,0.28);
- glPopMatrix();
- //lower-leg(left)-Rear
- glPushMatrix();
- glTranslatef(-(seat_length/2-leg_length/2),0,-(seat_width/2-leg_width/2));
- glScalef(leg_length,leg_height,leg_width);
- glTranslatef(-0.5,-1,-0.5);
- cube(0.45,0.49,0.28);
- glPopMatrix();
- //lower-leg(left)-Front
- glPushMatrix();
- glTranslatef(-(seat_length/2-leg_length/2),0,(seat_width/2-leg_width/2));
- glScalef(leg_length,leg_height,leg_width);
- glTranslatef(-0.5,-1,-0.5);
- cube(0.45,0.49,0.28);
- glPopMatrix();
- //lower-leg(right)-Rear
- glPushMatrix();
- glTranslatef((seat_length/2-leg_length/2),0,-(seat_width/2-leg_width/2));
- glScalef(leg_length,leg_height,leg_width);
- glTranslatef(-0.5,-1,-0.5);
- cube(0.45,0.49,0.28);
- glPopMatrix();
- //lower-leg(right)-Front
- glPushMatrix();
- glTranslatef((seat_length/2-leg_length/2),0,(seat_width/2-leg_width/2));
- glScalef(leg_length,leg_height,leg_width);
- glTranslatef(-0.5,-1,-0.5);
- cube(0.45,0.49,0.28);
- glPopMatrix();
- //Rail-upper
- glPushMatrix();
- glTranslatef(0,0,-(seat_width/2-leg_width/2));
- glScalef(seat_length,seat_height,leg_width);
- glTranslatef(-0.5,-1,-0.5);
- cube(0.45,0.49,0.28);
- glPopMatrix();
- //Rail-upper
- glPushMatrix();
- glTranslatef(0,8,-(seat_width/2-leg_width/2));
- glScalef(seat_length,seat_height,leg_width);
- glTranslatef(-0.5,-1,-0.5);
- cube(0.45,0.49,0.28);
- glPopMatrix();
- //Rail-upper
- glPushMatrix();
- glTranslatef(0,10,-(seat_width/2-leg_width/2));
- glScalef(seat_length,seat_height,leg_width);
- glTranslatef(-0.5,-1,-0.5);
- cube(0.45,0.49,0.28);
- glPopMatrix();
- //Rail-upper
- glPushMatrix();
- glTranslatef(0,12,-(seat_width/2-leg_width/2));
- glScalef(seat_length,seat_height,leg_width);
- glTranslatef(-0.5,-1,-0.5);
- cube(0.45,0.49,0.28);
- glPopMatrix();
- }
- void fan()
- {
- float base = 5;
- glPushMatrix();
- glRotatef(fan_rt,0,1,0);
- //fan-cap
- int cap_rot = 0;
- for(int i=0; i<100; i++)
- {
- glPushMatrix();
- glTranslatef(0,base/4,0);
- glRotatef(cap_rot,0,1,0);
- glScalef(base/4,base*2,base/4);
- glTranslatef(-0.5,0.0,-0.5);
- cube(1.000, 0.627, 0.478);
- glPopMatrix();
- cap_rot+=5;
- }
- //round-base
- int base_rot = 0;
- for (int i=0; i<100; i++)
- {
- glPushMatrix();
- //glTranslatef(0,top_width-(6*top_height),0);
- glRotatef(base_rot,0,1,0);
- glScalef(base,base/4,base);
- glTranslatef(-0.5,0.0,-0.5);
- cube(0.184, 0.310, 0.310);
- glPopMatrix();
- base_rot+=5;
- }
- //fan-leg
- for(int i=0; i<=2; i++)
- {
- glPushMatrix();
- glRotatef(120*i,0,1,0);
- glTranslatef((2*base)/2+base/2,base/8,0);
- glScalef(2*base,0.002*base,base/2);
- glTranslatef(-0.5,0.0,-0.5);
- cube(0.000, 0.000, 0.545);
- glPopMatrix();
- }
- fan_rotation();
- glPopMatrix();
- }
- void light_matter_1(float x, float y, float z)
- {
- GLfloat no_light[] = { 0.0, 0.0, 0.0, 1.0 };
- GLfloat light_ambient[] = {0.1, 0.1, 0.1, 1.0};
- GLfloat light_diffuse[] = { 1.0, 1.0, 1.0, 1.0 };
- GLfloat light_specular[] = { 1.0, 1.0, 1.0, 1.0 };
- GLfloat light_pos[] = { x,y,z,1};
- glEnable(GL_LIGHT0);
- if(light_1)
- {
- glLightfv( GL_LIGHT0, GL_AMBIENT, light_ambient);
- glLightfv( GL_LIGHT0, GL_DIFFUSE, light_diffuse);
- glLightfv( GL_LIGHT0, GL_SPECULAR, light_specular);
- }
- else
- {
- glLightfv( GL_LIGHT0, GL_AMBIENT, no_light);
- glLightfv( GL_LIGHT0, GL_DIFFUSE, no_light);
- glLightfv( GL_LIGHT0, GL_SPECULAR, no_light);
- }
- glLightfv( GL_LIGHT0, GL_POSITION, light_pos);
- }
- void light_matter_2(float x, float y, float z)
- {
- GLfloat no_light[] = { 0.0, 0.0, 0.0, 1.0 };
- GLfloat light_ambient[] = {0.1, 0.1, 0.1, 1.0};
- GLfloat light_diffuse[] = { 1.0, 1.0, 1.0, 1.0 };
- GLfloat light_specular[] = { 1.0, 1.0, 1.0, 1.0 };
- GLfloat light_pos[] = { x,y,z,1};
- glEnable(GL_LIGHT1);
- if(light_2)
- {
- glLightfv( GL_LIGHT1, GL_AMBIENT, light_ambient);
- glLightfv( GL_LIGHT1, GL_DIFFUSE, light_diffuse);
- glLightfv( GL_LIGHT1, GL_SPECULAR, light_specular);
- }
- else
- {
- glLightfv( GL_LIGHT1, GL_AMBIENT, no_light);
- glLightfv( GL_LIGHT1, GL_DIFFUSE, no_light);
- glLightfv( GL_LIGHT1, GL_SPECULAR, no_light);
- }
- glLightfv( GL_LIGHT1, GL_POSITION, light_pos);
- }
- void spot_light_matter(float x, float y, float z)
- {
- GLfloat no_light[] = { 0.0, 0.0, 0.0, 1.0 };
- GLfloat light_ambient[] = {0.5, 0, 0, 1.0};
- GLfloat light_diffuse[] = { 1, 0, 0, 1.0 };
- GLfloat light_specular[] = { 1.0, 1.0, 1.0, 1.0 };
- GLfloat light_pos[] = { x,y,z,1};
- glEnable(GL_LIGHT7);
- if(light_3)
- {
- glLightfv( GL_LIGHT7, GL_AMBIENT, light_ambient);
- glLightfv( GL_LIGHT7, GL_DIFFUSE, light_diffuse);
- glLightfv( GL_LIGHT7, GL_SPECULAR, light_specular);
- }
- else
- {
- glLightfv( GL_LIGHT7, GL_AMBIENT, no_light);
- glLightfv( GL_LIGHT7, GL_DIFFUSE, no_light);
- glLightfv( GL_LIGHT7, GL_SPECULAR, no_light);
- }
- glLightfv( GL_LIGHT7, GL_POSITION, light_pos);
- GLfloat direction[] = {0,-1,0,1};
- GLfloat cut_off = 25.0;
- glLightfv(GL_LIGHT7, GL_SPOT_DIRECTION, direction );
- glLightf(GL_LIGHT7, GL_SPOT_CUTOFF, 25 );
- }
- void light()
- {
- float light_length = 20, light_width = 1, light_height = 2;
- float bar_length = 2, bar_height = light_height+1, bar_width = 2;
- //light-holder
- glPushMatrix();
- glScalef(light_length-2,light_height+1,light_width);
- glTranslatef(-0.5,0,-0.5);
- cube(1.000, 1.000, 1.000);
- glPopMatrix();
- //light bar
- for(int i=-1; i<=1; i+=2)
- {
- glPushMatrix();
- glTranslatef(i*(light_length/2-bar_length/2),0,0);
- glScalef(bar_length,bar_height,bar_width);
- glTranslatef(-0.5,0,-0.5);
- cube(0, 0.941, 0.902);
- glPopMatrix();
- }
- }
- void door()
- {
- float window_length = 10, window_height = 15, window_width = 0.5;
- float bar_dense = 0.3;
- //window blue glass
- glPushMatrix();
- glScalef(window_length-2,window_height,window_width);
- glTranslatef(-0.5,0.0,-0.5);
- cube(0.275, 0.510, 0.706);
- glPopMatrix();
- //right-middle-left bar
- for(int i=-1; i<=1; i+=1)
- {
- glPushMatrix();
- glTranslatef(i*(window_length/2-(4*bar_dense)/2),0,bar_dense/2);
- glScalef(4*bar_dense,window_height,bar_dense);
- glTranslatef(-0.5,0.0,-0.5);
- cube(0.65,0.4,0.3);
- glPopMatrix();
- }
- // handle
- int c=0;
- for(float i=-0.3; i<=0.3; i+=0.6)
- {
- glPushMatrix();
- glTranslatef(i,(window_height/2),bar_dense);
- glScalef(bar_dense,10*bar_dense,bar_dense);
- glTranslatef(-0.5,0.0,-0.5);
- cube(1, 1, 1);
- glPopMatrix();
- }
- }
- void st_desk()
- {
- glPushMatrix();
- glTranslatef(0,-8,0);
- glScalef(1,2,1);
- table();
- glPopMatrix();
- glPushMatrix();
- glTranslatef(-2,2.5,15);
- glRotatef(180,0,1,0);
- glScalef(1,2,0.5);
- chair();
- glPopMatrix();
- }
- void classroom()
- {
- float room_length = 90, room_height = 60, room_width = 100, flr_dense = 0.3;
- //floor
- glPushMatrix();
- glTranslatef(0,0,0);
- glScalef(room_length,flr_dense,room_width);
- glTranslatef(-0.5,-1,-0.5);
- //cube(0.467, 0.533, 0.60);
- cube(0.502, 0.502, 0.502);
- glPopMatrix();
- // //roof
- glPushMatrix();
- glTranslatef(0,1*room_height,0);
- glScalef(room_length,flr_dense,room_width);
- glTranslatef(-0.5,-1,-0.5);
- //cube(0.7,0.7,0.7);
- cube(0.741, 0.718, 0.420);
- glPopMatrix();
- //
- //
- for(int i=-(room_width/2); i<=(room_width)/2; i+=5)
- {
- glPushMatrix();
- glTranslatef(0,0.1,i);
- glScalef(room_length,flr_dense,flr_dense/4);
- glTranslatef(-0.5,-1,-0.5);
- cube(0.000, 0.000, 0.0);
- glPopMatrix();
- }
- //
- //
- // //side-wall
- for(int i=-1; i<=1; i+=2)
- {
- glPushMatrix();
- glTranslatef(i*(room_length/2-flr_dense/2),0,0);
- glScalef(flr_dense,room_height,room_width);
- glTranslatef(-0.5,0,-0.5);
- //cube(1.000, 0.871, 0.678);
- cube(0.502, 0.502, 0.000);
- glPopMatrix();
- }
- //
- // //front wall
- glPushMatrix();
- glTranslatef(0,0,-(room_width/2-flr_dense/2));
- glScalef(room_length,room_height,flr_dense);
- glTranslatef(-0.5,0,-0.5);
- //cube(0.741, 0.718, 0.420);
- cube(0.373, 0.620, 0.627);
- glPopMatrix();
- // //back wall
- glPushMatrix();
- glTranslatef(0,0,(room_width/2-flr_dense/2));
- glScalef(room_length,room_height,flr_dense);
- glTranslatef(-0.5,0,-0.5);
- //cube(0.741, 0.718, 0.420);
- cube(0.741, 0.718, 0.420);
- glPopMatrix();
- //
- // //board
- glPushMatrix();
- glTranslatef(0,room_height/2-room_height/4+4,-(room_width/2-flr_dense/2-3));
- glScalef(room_length/1.5,room_height/2,flr_dense);
- glTranslatef(-0.5,0,-0.5);
- cube(1,1,1);
- glPopMatrix();
- //
- //
- //
- // //side-light
- for(int i=-1; i<=1; i+=2)
- {
- glPushMatrix();
- glTranslatef(i*(room_length/2-3.5),room_height/1.3,20);
- glRotatef(-90,0,1,0);
- glScalef(0.5,1,1);
- light();
- glPopMatrix();
- }
- glPushMatrix();
- light_matter_1(-(room_length/2-3.5),room_height/1.3,20);
- glPopMatrix();
- glPushMatrix();
- //glRotatef(90,0,0,1);
- light_matter_2((room_length/2-3.5),room_height/1.3,20);
- glPopMatrix();
- //spot_light
- glPushMatrix();
- glTranslatef(0,room_height/1.5,0);
- glScalef(5,5,5);
- glTranslatef(-0.5,-0.5,-0.5);
- cube(0.5,0,0);
- glPopMatrix();
- glPushMatrix();
- spot_light_matter(0,room_height/1.5,0);
- glPopMatrix();
- //
- //
- // //teacher-platform
- glPushMatrix();
- glTranslatef(0,0,-(room_width/2-flr_dense/2-7));
- glScalef(room_length-12,room_height/7,room_width/9);
- glTranslatef(-0.5,0,-0.5);
- cube(0.529, 0.808, 0.922);
- glPopMatrix();
- //
- glPushMatrix();
- glTranslatef(0,room_height-5,0);
- glScalef(1,1,1);
- glTranslatef(-0.5,-1,-0.5);
- fan();
- glPopMatrix();
- //
- //
- // //door
- glPushMatrix();
- glTranslatef(-(room_length/2),room_height/2-30,-25);
- glRotatef(90,0,1,0);
- glScalef(1,3,2);
- door();
- glPopMatrix();
- // //chair-table
- for(int i=5; i<=40; i+=15)
- {
- for(int j=-(room_length/2-20); j<=room_length/2; j+=25)
- {
- glPushMatrix();
- glTranslatef(j,10,i);
- glScalef(0.5,0.5,0.5);
- st_desk();
- glPopMatrix();
- }
- }
- }
- static void res(int width, int height)
- {
- glViewport(0, 0, window_width, window_width/rat);
- }
- static void display(void)
- {
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- int lim = 8;
- glFrustum(-lim, lim, -lim, lim, 4, 100);
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity() ;
- //gluLookAt(eyeX,eyeY,eyeZ, lookX,lookY,lookZ, 0,1,0);
- //gluLookAt(eye[0],eye[1],eye[2], look[0],look[1],look[2], 0,1,0);
- //glViewport(0, 0, window_width, window_height);
- gluLookAt(eyeX,eyeY,eyeZ, lookX,lookY,lookZ, 0,1,0);
- //glViewport(0, 0, window_width, window_height);
- glRotatef(rot, 0,1,0);
- classroom();
- glutSwapBuffers();
- }
- static void key(unsigned char key, int x, int y)
- {
- switch (key)
- {
- //case 'm':
- // sakib ++;
- // break;
- //case 'M':
- // sakib --;
- // break;
- case 'q':
- exit(0);
- break;
- case 'w':
- if(up<=11)
- {
- up++;
- down--;
- eyeY++;
- lookY++;
- }
- break;
- case 's':
- if(down<=30)
- {
- down++;
- up--;
- eyeY--;
- lookY--;
- }
- break;
- case 'a':
- rot--;
- break;
- case 'd':
- rot++;
- break;
- case 'l':
- if(r<=36)
- {
- r++;
- l--;
- eyeX++;
- lookX++;
- }
- break;
- case 'j':
- if(l<=36)
- {
- r--;
- l++;
- eyeX--;
- lookX--;
- }
- break;
- case '+':
- eyeZ--;
- break;
- case 'i':
- eyeZ--;
- break;
- case '-':
- eyeZ++;
- break;
- case 'k':
- eyeZ++;
- break;
- case '1':
- light_1 = 1-light_1;
- break;
- case '2':
- light_2 = 1-light_2;
- break;
- case '3':
- light_3 = 1-light_3;
- break;
- }
- glutPostRedisplay();
- }
- int main(int argc, char *argv[])
- {
- glutInit(&argc, argv);
- glutInitWindowSize(window_width,window_height);
- glutInitWindowPosition(300,10);
- glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
- glutCreateWindow("Class Room");
- glutDisplayFunc(display);
- glutKeyboardFunc(key);
- //glutReshapeFunc(resize);
- glEnable(GL_DEPTH_TEST);
- glShadeModel( GL_SMOOTH );
- glEnable(GL_NORMALIZE);
- glEnable(GL_BLEND);
- glEnable(GL_LIGHTING);
- glutMainLoop();
- return EXIT_SUCCESS;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement