Reset frame count and time when reloading shaders
Define a struct to hold the renderer state.
This commit is contained in:
parent
685e2e62ce
commit
6f21d1e0ec
3 changed files with 81 additions and 69 deletions
|
@ -3,6 +3,22 @@
|
|||
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
/**
|
||||
* Structure representing the state of the renderer and associated
|
||||
* shaders.
|
||||
*/
|
||||
struct renderer_state {
|
||||
GLFWwindow *window; /**< GLFW window where the shaders are rendered. */
|
||||
unsigned int screen_shader; /**< Shader for the main screen. */
|
||||
const char *screen_shader_file; /**< Screen shader file name. */
|
||||
unsigned int buffer_shader; /**< Shader for the background framebuffer. */
|
||||
const char *buffer_shader_file; /**< Buffer shader file name. */
|
||||
size_t frame_count; /**< Frame count since the beginning of the render loop. */
|
||||
size_t prev_frame_count; /**< Frame count at the last log. */
|
||||
double time; /**< Time in seconds since the beginning of the render loop. */
|
||||
double prev_time; /**< Time in seconds at the last log. */
|
||||
};
|
||||
|
||||
GLFWwindow *initialize_window(int width, int height);
|
||||
unsigned int initialize_vertices();
|
||||
unsigned int initialize_framebuffer(unsigned int *framebuffer,
|
||||
|
@ -11,9 +27,6 @@ unsigned int initialize_framebuffer(unsigned int *framebuffer,
|
|||
unsigned int texture_height);
|
||||
void framebuffer_size_callback(GLFWwindow *window, int width, int height);
|
||||
void capture_screenshot();
|
||||
void process_input(GLFWwindow *window, unsigned int *screen_shader,
|
||||
const char *const screen_shader_file,
|
||||
unsigned int *buffer_shader,
|
||||
const char *const buffer_shader_file);
|
||||
void process_input(struct renderer_state *state);
|
||||
|
||||
#endif /* RENDERER_H */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue