Hallo alle,
kann jemand mir vielleicht helfen? ich versuche Dame-spiel zu programmieren! wie kann ich erst diese brett (8*
in Hell und dunkel machen? und wie kann ich nachher die objekte drauf einsetzen?
hier ist mein Code aber ist nicht vollständig!
#include <GL/glut.h> //GLUT .h-Datei, lädt auch GL .h-Dateien
#include <gl\gl.h>
#include <iostream.h>
#include "Wuerfel.h"
float fRotation = -45.0;// fRotation globaler variable
void Animate(int value)
{
fRotation = fRotation - 1.0;
if (fRotation <= 0.0)
{
fRotation = 5.0;
}
glutPostRedisplay();
glutTimerFunc(50,Animate,0);
}
void RenderScene(void)
{
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
glLoadIdentity();
glOrtho( -2., 2., -2, +2, -2., 2.);
gluLookAt(0.,1., 1.,0.,0,0,0,1.,0);
//gluLookAt(0.,1., 0.,0.,0,0,0,0.,-1); von Open
//gluLookAt(0.,1., -0.1,0.,8,8,0,1.,0); Open schräg
glScalef(0.5,0.5,0.5);
for(int i = 1; i < 10; i++) {
glPushMatrix(); //Matrix wird auf den Stack gesichert
//glRotatef(fRotation,0, 0., 1);
glTranslatef( 2.0, 0., 0.); //T3
glScalef(0.5, 1.0, 0.); //S2
Wuerfel(1.0);
glPopMatrix(); //Matrix wird wieder aktiviert
}
//glRotatef(fRotation,0, 1., 0);
/*glPushMatrix(); //Matrix wird auf den Stack gesichert
//glRotatef(fRotation,0, 0., 1);
glTranslatef( 1.75, 0., 0.); //T3
glScalef(0.5, 0.25, 1.); //S2
glScalef(0.2, 0.15, 0.5); //S2
Wuerfel(1.5);
glPopMatrix(); //Matrix wird wieder aktiviert*/
glutSwapBuffers();
glFlush();
}
int main(int argc, char **argv)
{
glutInit( &argc, argv );
glutInitDisplayMode( GLUT_DOUBLE|GLUT_RGB|GLUT_DEPTH );
glutCreateWindow("OpenGL Aufgabe");
glEnable(GL_DEPTH_TEST);
glutDisplayFunc( RenderScene );
glutTimerFunc(50,Animate,0);
glutMainLoop();
return 0;
}