Skip to content

Instantly share code, notes, and snippets.

@liam-middlebrook
Last active August 29, 2015 13:56
Show Gist options
  • Save liam-middlebrook/9127067 to your computer and use it in GitHub Desktop.
Save liam-middlebrook/9127067 to your computer and use it in GitHub Desktop.
/*
MINX - A C++ Graphics and Input Wrapper Library ( http://github.com/GearChicken/MINX )
Copyright (C) 2013-2014 MINX Team
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
// GLFW Resize Window Callback WITHOUT Scaling
void windowResizeCallback(GLFWwindow* window, int width, int height)
{
if (!width || !height) //If the width or height are 0, return
{
return;
}
//Set the Width and Height to the new values
GameWindow::SetWidth(width);
GameWindow::SetHeight(height);
glfwSetWindowSize(window, GameWindow::GetWidth(), GameWindow::GetHeight());
//IMPORTANT
// Set the GL viewport to scale up/down to the new Width and Height
// If this is not included then the textures will appear to scale
// inversely corresponding to the change in window size
glViewport(0, 0, GameWindow::GetWidth(), GameWindow::GetHeight());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment