Graphics Class - HPC-Vis/computer-graphics GitHub Wiki
Functions
Graphics()
No Functionality.
~Graphics()
No Functionality.
bool Initialize(int width, int height)
The initialize function is in charge of setting all the graphics items up. Starting if this is run on a Linux machine GLEW must be started.To use OpenGL 3.3 a vertex array must be bound, but it will not be utilized in this program. Then the camera, object, and shaders are created. The shader must initialize, then a vertex and fragment shader must be added, and finally the shaders must be finalized. Within the shader code there is a projection, view, and model that need data sent to them. These require knowledge of where they are, so data can be pushed to them for rendering purposes. Finally a adding a GL depth test, and return success.
void Update(unsigned int dt)
Update will just run the update on the object.
void Render()
Render will clear the screen for a redraw first. The program being used for this particular render must be enabled. The projection and view are passed to the GPU; gathered from the camera. The model is also passed in which is gathered from the object. The object is rendered. Then there is a check for any errors.
Variables
Camera *m_camera
The camera for the scene.
Shader *m_shader
The shader for the scene. Used to compile and add in variables from CPU to GPU.
GLint m_projectionMatrix
This is used to point to the location of the projection in the shader.
GLint m_viewMatrix
This is used to point to the location of the view in the shader.
GLint m_modelMatrix
This is used to point to the location of the model in the shader.
Object *m_object
The square object in the scene.