Scale up viewport to fit window.

Started by
1 comment, last by Hintze 9 years, 7 months ago

Hey guys!

I got a little problem that hopefully is an easy to solve one.

I am using a mbp with a retina screen so when i in glfw call to create a window it creates one with twice the size of the parameters i send in.

I have implemented deffered rendering so i tried creating the textures with my desired resolution(half the size of the actual framebuffer). If I create my viewport with my desired resolution I only get a quarter of the screen when i draw out. But if I create a viewport with the actual frame buffer size I can scale up the texture but the center of the screen is somehow in the top corner, as if i try to move towards an object i move diagonally towards the top right corner.

Hope someone can shed some light on this one :)

thanks for your time!

//Hintze

Advertisement

Fix your projection matrix or, if you are just rendering a 2D texture, don’t even use a projection matrix and use vertex coordinates from -1 to 1.

There isn’t much else to say unless you post some code.

L. Spiro

I restore Nintendo 64 video-game OST’s into HD! https://www.youtube.com/channel/UCCtX_wedtZ5BoyQBXEhnVZw/playlists?view=1&sort=lad&flow=grid

I figured out one way to solve it and thought i share it if someone ever gets the same issue.

I simply made a viewport with the desired texture resolution and then rendered into the texture and then before drawing the texture to the screen resizing the viewport to the actual window size and then scaling the texture up in the shader.

//Hintze

This topic is closed to new replies.

Advertisement