Add framebuffer resize callback
This commit is contained in:
parent
4eb6d9de2c
commit
1b9b0d85e6
|
@ -56,6 +56,14 @@ GLuint g_program_id = 0;
|
||||||
static GLuint translate_unif;
|
static GLuint translate_unif;
|
||||||
static GLuint rotate_unif;
|
static GLuint rotate_unif;
|
||||||
|
|
||||||
|
void framebuffer_size_callback(GLFWwindow* window, int width, int height)
|
||||||
|
{
|
||||||
|
// make sure the viewport matches the new window dimensions; note that width and
|
||||||
|
// height will be significantly larger than specified on retina displays.
|
||||||
|
glViewport(0, 0, width, height);
|
||||||
|
// Re-render the scene because the current frame was drawn for the old resolution
|
||||||
|
}
|
||||||
|
|
||||||
static void init_shaders() {
|
static void init_shaders() {
|
||||||
dbg_log("Initialising shaders");
|
dbg_log("Initialising shaders");
|
||||||
|
|
||||||
|
@ -134,6 +142,7 @@ int main() {
|
||||||
|
|
||||||
// Set up the key handler
|
// Set up the key handler
|
||||||
glfwSetKeyCallback(w, key_callback);
|
glfwSetKeyCallback(w, key_callback);
|
||||||
|
glfwSetFramebufferSizeCallback(w, framebuffer_size_callback);
|
||||||
|
|
||||||
init_opengl();
|
init_opengl();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue