Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <GL/glut.h>
- #define GROUND 1
- void make_ground();
- void display()
- {
- make_ground();
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
- //glRotatef(-30, 1.0, 0.0, 0.0);
- glRotatef(170, 0.0, 1.0, 0.0);
- glRotatef(20, 0.0, 0.0, 1.0);
- glCallList(GROUND);
- glFlush();
- }
- void make_ground() {
- glNewList(GROUND, GL_COMPILE);
- //glColor3f(1.0, 0.0, 1.0);
- // Draw the sides of the three-sided pyramid
- /*glBegin(GL_TRIANGLE_FAN);
- glVertex3d(0, 4, 0);
- glVertex3d(0, -4, -4);
- glVertex3d(-4, -4, 4);
- glVertex3d(4, -4, 4);
- glVertex3d(0, -4, -4);
- glEnd();*/
- glColor3f(0.0, 1.0, 1.0);
- // Draw the base of the pyramid
- glBegin(GL_TRIANGLES);
- glVertex3d(-4, -4, 4);
- glVertex3d(4, -4, 4);
- glVertex3d(4, -4, -4);
- glVertex3d(-4,-4,-4);
- glEnd();
- glEndList();
- }
- void init()
- {
- /* izbor na pozadinska boja */
- glClearColor (1.0, 1.0, 1.0, 0.0);
- /* inicijalizacija na pogledot */
- glMatrixMode(GL_PROJECTION); //Sledat matricni transformacii vrz proekcijata
- glLoadIdentity();
- glOrtho(-10.0, 10.0, -10.0, 10.0, -5.0, 5.0); // Koj del od 3D prostorot da se proektira
- }
- int main(int argc, char** argv)
- {
- void display(void);
- glutInit(&argc, argv);
- glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB); //display mode (edinecen bafer i RGBA)
- glutInitWindowSize (400, 400); //inicijalna golemina na prozorec
- glutInitWindowPosition (400, 200); //pozicija
- glutCreateWindow ("Zdravo"); //Otvori prozor so "Zdravo" vo naslovot
- init(); //Inicijalizacija
- glutDisplayFunc(display); //regsitracija na callback funkcija
- glutMainLoop(); //pocetok na beskonecniot ciklus
- return 0;
- }
Add Comment
Please, Sign In to add comment