Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include "TdisplayImp.h"
- #include "Ground.h"
- void TDisplayImp::init(void)
- {
- }
- void TDisplayImp::initialiseOpenGL(int argc, char** argv)
- {
- glutInit(&argc, argv);
- glutInitDisplayMode (GLUT_DOUBLE | GLUT_RGB);
- glutInitWindowSize (400, 400);
- glutInitWindowPosition (200, 200);
- glutCreateWindow ("Breakout Game");
- init();
- glutReshapeFunc(TDisplayImp::reshape);
- glutDisplayFunc(TDisplayImp::displayCallBack);
- glutKeyboardFunc(TDisplayImp::KeyboardCallBack);
- glutSpecialFunc(TDisplayImp::SpecialKeyboardCallBack);
- glutIdleFunc(TDisplayImp::idle);
- }
- void TDisplayImp::reshape(int w, int h)
- {
- glViewport(0,0,(GLsizei)w,(GLsizei)h);
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- gluPerspective(40.0,(GLdouble)w/(GLdouble)h, 1.0, 1000.0);
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
- }
- void TDisplayImp::idle(void)
- {
- glutPostRedisplay();
- }
- void TDisplayImp::renderScene()
- {
- glutMainLoop();
- }
- void TDisplayImp::displayCallBack()
- {
- glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
- gluLookAt(100,100,20,0,0,0,0,10,0);
- //glPushMatrix();
- TGround ground;
- ground.DrawGround();
- //glPopMatrix();
- glutSwapBuffers();
- }
- void TDisplayImp::KeyboardCallBack(unsigned char key, int A, int B)
- {
- glutPostRedisplay();
- }
- void TDisplayImp::SpecialKeyboardCallBack(int key1, int A, int B)
- {
- glutPostRedisplay();
- }
- void main(int argc, char** argv)
- {
- TDisplayImp::initialiseOpenGL(argc, argv);
- TDisplayImp::renderScene();
- }
Add Comment
Please, Sign In to add comment