# How to scale-to-fit OGL viewport to GLFW window?

Say my window is 1280x720. I want to render my stuff to lower resolution and then stretch it to window. I've tried this:

glViewport(0, 0, 1280 / 2, 720 / 2);


When I call glViewport and pass lesser width and height than window, I get all my OpenGL rendering in left bottom 1/4 of window. I need to scale it (linear filtering preferably) back to window size so I would get a pixelated effect.

I wonder if there is such possibility within glad/glfw API.

• It is unclear what your main problem is, you should describe more widely what you're trying to do. The code you included, is it what you have tried so far? What happened when you didn't succeed? – liggiorgio May 24 '18 at 14:06
• Pretty sure i described my problem well enough. When I call glViewport and pass lesser width and height than window i get all my opengl rendering in left bottom 1/4 of window. I need to scale it (linear filtering preferably) back to window size so i would get pixelated effect. – user1378398 May 24 '18 at 14:54