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 <GL/glut.h> //GLUT .h-Datei, l�dt auch GL .h-Dateien
#include "Wuerfel.h"
#include <windows.h>
#include <cmath>
#include <iostream>
float fRotY=0;
void Compute(void)
{
fRotY+=20;
glutPostRedisplay();
Sleep(500);
}
void RenderScene(void)
{
glClearColor(1.f, .5f, 0.f, 1.f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
//glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho( -2., 2., -2., 2., -2., 2.);
//glTranslatef(x , 0., -1.);
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
//glMatrixMode(GL_MODELVIEW);
//glLoadIdentity();
gluLookAt(0., 0., 1.,
0., 0., 0.,
0, 1, 0.);
//glRotatef(fRotY, 0., 1., 0.);
glRotatef(-45,0.f,0.f,1.f);
glPushMatrix();
glScalef(2.f,0.7f,0.7f);
Wuerfel(0.4);
glPopMatrix();
glScalef(1.5f,0.3f,0.3f);
glTranslatef(0.8f,0.f,0.f);
Wuerfel(0.4);
//glFlush();
glutSwapBuffers();
}
int main(int argc, char **argv)
{
glutInit( &argc, argv );
glutInitDisplayMode( GLUT_DOUBLE|
GLUT_RGB|GLUT_DEPTH );
glutCreateWindow("OpenGL Kamera");
glutDisplayFunc( RenderScene );
//glutIdleFunc(Compute);
glEnable(GL_DEPTH_TEST);
glutMainLoop();
return 0;
}
|