-
Notifications
You must be signed in to change notification settings - Fork 4
3. Blitting and clearing the viewport
theproadam edited this page Apr 2, 2020
·
2 revisions
To display an image, we must first clear the drawing buffer. As the both the drawing and depth buffers are allocated with Marshal.AllocHGlobal(), it is very important to clear them, as they are not automatically zeroed out.
//Clears the drawing buffer with black. ~0.2ms
GL.Clear();
//Clears the drawing buffer with a color. ~0.5ms
GL.Clear(R, G, B);
//Clears the depth buffer. ~0.2ms
GL.ClearDepth();
It is suggested to use the Clear(); method as it is much faster than the Clear(R, G, B); method.
Now to display the color change of the drawing buffer, the drawing buffer needs to be blitted to the form. To do this just use the Blit() function.
GL.Blit();
- Initializing the renderer
- Setting the transform data
- Blitting and clearing the viewport
- Initializing a vertex buffer
- Creating a shader
- Drawing an object
- Screen space shaders
- Blitting bitmaps
- Loading a texture
- Creating a framebuffer
- Displaying a texture