Wednesday, 7 February 2018

Week 1 – Game Engine

In the first session for the game tutorial engine, I have created an empty C++ project which eventually will become the game for the assessment. After the project was created, the next step was to add a .cpp file where a simple scene will be created. Following the creation of the .cpp file, a number of libraries had to be included in the directories of the project in order the code which will be written in the file to work properly. After the first tasks were completed, the empty C++ file had to be completed with the code necessary to create the first scene of the game, code which was provided already. Following the creation of the file and the introduction of the libraries, necessary for the project, I wanted to understand the code better so I tried to “play” with it by changing different variables from the drawScene() function, variables like the colour of the spaceship and the asteroid or changing the position of the objects as well as the position and the size of the window which is displaying the objects.






In order to understand the code, even more, I had to document myself about the glut functions and their functionality so I researched the purposes of each Glut function and found out which function does what, for example, the glutPostRedisplay function imprint the "current window " as demanding to be redisplayed or the glutInitDisplayMode which is used when top-level windows, subwindows and overlays are projected to determine the OpenGL display mode for the overlay which will be created. Functions like glutInitWindowSize() and glutInitWindowPosition() set the initial window position and size respectively. A window which got created by glutCreateWindow() will be requested to be created with the current initial window position and size. The glutDisplayFunc() confirms the display call back for the current window. When GLUT determines that the plane for the window needs to be redisplayed, a callback display for the window is getting called. glutReshapeFunc() function reshapes the callback for the current window, a factor that can be determined from its name. With the help of the function entitled glutKeyboardFunc(), when a user typed something into the window each key which is being pressed generates an ASCII character. The last function, glutIdleFunc(), sets the global idle callback.


No comments:

Post a Comment