1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
|
#include<windows.h>
#include<gl/gl.h>
#include<gl/glut.h>
#define width 640
#define hight 480
void display();
void reshape(int,int);
int main(int arg, char** arc)
{
glutInit(&arg,arc);
glutInitDisplayMode(GLUT_RGBA );
glutInitWindowSize(width,hight);
glutInitWindowPosition(320,240);
glutCreateWindow("Creation de cube avec des surfaces ");
glutDisplayFunc(display);
glutReshapeFunc(reshape);
glutMainLoop();
return 0;
}
void display()
{
glClearColor(0,0,0,0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glLoadIdentity();
gluLookAt(0,0,8,0,0,0,0,1,0);
glutWireCube(2.0);
glFlush();
}
void reshape(int w, int h)
{
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(90, (double)w/h, 0.0, 2.0);
glViewport(0,0,w,h);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
} |
Partager