Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <windows.h>
- #include <iostream>
- #include <GL/glut.h>
- #include <stdio.h>
- #include <stdlib.h>
- #include <time.h>
- #include <math.h>
- int screenWidth = 1000;
- int screenHeight = 600;
- GLfloat Points[4][3] = {
- {-5.0f,1.0f,1.0f},
- { -9.0f,5.0f,1.0f },
- { -1.0f,6.0f,1.0f },
- { -2.0f,2.0f,1.0f }
- };
- void initScene() {
- glEnable(GL_DEPTH_TEST);
- glEnable(GL_MAP1_VERTEX_3);
- glEnable(GL_POINT_SMOOTH);
- }
- void display() {
- glClearColor(0.0, 0.0, 0.0, 0.0);
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
- glLoadIdentity();
- glTranslatef(0, 0, -40.0f);
- glColor3f(1.0f, 0.0f, 0.0f);
- glutSolidCube(1);
- glutSwapBuffers();
- glutPostRedisplay();
- }
- void reshape(int w, int h) {
- glViewport(0, 0, (GLsizei)w, (GLsizei)h);
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- gluPerspective(50,(float)w/h,0.1,1000);
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
- }
- int main(int argc, char *argv[])
- {
- glutInit(&argc, argv);
- glutInitDisplayMode(GLUT_DEPTH | GLUT_RGB | GLUT_DOUBLE);
- glutInitWindowSize(screenWidth, screenHeight);
- glutCreateWindow(argv[0]);
- initScene();
- glutIdleFunc(display);
- glutDisplayFunc(display);
- glutReshapeFunc(reshape);
- glutMainLoop();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement