partial implementation of double buffered render
This commit is contained in:
@ -32,7 +32,7 @@ void specify_vertex_buffer(VertexBuffer buffer, void const *data, size_t bytes)
|
||||
}
|
||||
|
||||
|
||||
void bind_quad_element_buffer(void) {
|
||||
VertexBuffer get_quad_element_buffer(void) {
|
||||
static GLuint buffer = 0;
|
||||
|
||||
/* it's only generated once at runtime */
|
||||
@ -62,32 +62,8 @@ void bind_quad_element_buffer(void) {
|
||||
|
||||
} else
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, buffer);
|
||||
}
|
||||
|
||||
|
||||
void clear_draw_buffer(void) {
|
||||
/* TODO: we can optimize a rectangle drawn over whole window to a clear color call*/
|
||||
glClearColor((1.0f / 255) * 230,
|
||||
(1.0f / 255) * 230,
|
||||
(1.0f / 255) * 230, 1);
|
||||
|
||||
glDepthRange(0.0, 1.0);
|
||||
glDepthMask(GL_TRUE);
|
||||
|
||||
/* TODO: don't clear color when skybox is applied? */
|
||||
/* for that window should match framebuffer */
|
||||
/* also it is driver dependent, from what i can gather */
|
||||
/* INFO: also, based on below, driver might prefer it staying this way */
|
||||
/* https://gamedev.stackexchange.com/questions/90344/render-with-const-depth-value */
|
||||
/* we could optionally load ARB_invalidate_subdata extension if it's available instead */
|
||||
glClear(GL_COLOR_BUFFER_BIT |
|
||||
GL_DEPTH_BUFFER_BIT |
|
||||
GL_STENCIL_BUFFER_BIT);
|
||||
}
|
||||
|
||||
|
||||
void swap_buffers(void) {
|
||||
SDL_GL_SwapWindow(ctx.window);
|
||||
return buffer;
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user