Skip to content

Instantly share code, notes, and snippets.

@stuartwakefield
Last active May 11, 2016 11:59
Show Gist options
  • Save stuartwakefield/409f0bcf254ddf8ec36cd197926a196a to your computer and use it in GitHub Desktop.
Save stuartwakefield/409f0bcf254ddf8ec36cd197926a196a to your computer and use it in GitHub Desktop.
Sets the GL viewport based correctly for higher DPI monitors
public class GLFWGLViewport {
public void apply(GLWindow window) {
IntBuffer wbuf = BufferUtils.createIntBuffer(1);
IntBuffer hbuf = BufferUtils.createIntBuffer(1);
GLFW.glfwGetFramebufferSize(window.getId(), wbuf, hbuf);
int w = wbuf.get(0);
int h = hbuf.get(0);
GL11.glViewport(0, 0, w, h);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment