0
\$\begingroup\$

I have a quad rendered that extends from the top left of the window to with width of the window that is also 64 pixels high. When I resize the window, from its initial size, the quad and text scales proportionately bigger or smaller in the same say Photoshop can scale a image. What I'm seeking on a basic level is that regardless of how I resize the window, everything drawn remains the same. From the below image, the right side is the initial size and the left side is what happens when I drag the window to be a smaller size. The red bar and text scales with it. This is how Im handling my resizing:

glfwSetWindowSizeCallback(pWindow, WindowSizeCallback); // initialized after context

void WindowSizeCallback(GLFWwindow* window, int width, int height)
{
    glfwSetWindowSize(window, width, height);    
}

enter image description here

\$\endgroup\$

1 Answer 1

0
\$\begingroup\$

You need to call glViewport(0, 0, width, height); when your framebuffer size changes. Do note that glfwSetWindowSizeCallback gives you screen coordinates, so perhaps instead of sticking the glViewport call inside glfwSetWindowSizeCallback, you want to set it from glfwSetFramebufferSizeCallback.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .