Overview
This post discusses implementing the basic operations of creating a hosting window, Initializing it with OpenGL context, rendering and handle mouse/keyboard inputs.
Details
This purpose of Lesson01 is to create a Host Window, initialized with OpenGL context and fill it with fuchsia color.
System class diagram
The functionality is implemented in the Scene class derived from BaseScene class.Implementation
Scene
The three methods Init,DrawScene and Cleanup are overridden as below.
The Init method calls BaseScene::Init to create hosting window and OpenGL Context.
The DrawScene method clears the window and paints it with fuchsia color.
The Cleanup method does not do anything.
The BaseCamera::camera is not initialized and stays as nullptr hence no keyboard or mouse inputs are processed other than Escape key.
Finally, the WM_CLOSE event is handled in OnCloseWindow function, and the window is destroyed and application is shutdown when the window is closed or Escape key is pressed.
Application
Scene class is hosted main.cpp. which creates the scene object and displays it. Message pump is added to process windows messages.
Output
The output looks as shown in the top.
The Source Code can be accessed from Lesson01 Initializing OpenGL Context
The binaries can be accessed from here.

No comments:
Post a Comment