Sign in to follow this  
Hintze

Scale up viewport to fit window.

Recommended Posts

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this