Initialisation
- Create
window that has size width, height
- Use
WGL to initialise OpenGL
- SetPixelFormat(...)
- wglCreateContextAttribsARB(...)
- wglMakeCurrent(...)
- Set
up viewport
- glViewport(0, 0, width, height);
- Set
up the projection matrix
- glm::perspective(45.0f, (GLfloat)width/(GLfloat)height, 1, 150.0f);
- Load
shaders and
other resources, compile, pass to GPU
- Pass
geometry to GPU
Typically
the modeling,
viewing, and projection matrices are used in the
vertex shader to
transform points.
Rendering
a frame
- Clear
the buffers
- glClear(GL_COLOR_BUFFER_BIT |
GL_DEPTH_BUFFER_BIT);
- Set
the view (or modelview)
matrix
- Set
the model (or modelview)
matrix
- glm::translate(), glm::rotate(),
glm::scale()
- Pass matrices to shader
- Render object
- Swap buffers to display the rendered
frame
Just with this you could make a game!