Jump to content

  • Log In with Google      Sign In   
  • Create Account

Scale up viewport to fit window.

  • You cannot reply to this topic
2 replies to this topic

#1 Hintze   Members   -  Reputation: 120


Posted 26 August 2014 - 01:29 PM

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!



#2 L. Spiro   Crossbones+   -  Reputation: 13433


Posted 26 August 2014 - 02:20 PM

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

It is amazing how often people try to be unique, and yet they are always trying to make others be like them. - L. Spiro 2011
I spent most of my life learning the courage it takes to go out and get what I want. Now that I have it, I am not sure exactly what it is that I want. - L. Spiro 2013
I went to my local Subway once to find some guy yelling at the staff. When someone finally came to take my order and asked, “May I help you?”, I replied, “Yeah, I’ll have one asshole to go.”
L. Spiro Engine: http://lspiroengine.com
L. Spiro Engine Forums: http://lspiroengine.com/forums

#3 Hintze   Members   -  Reputation: 120


Posted 31 August 2014 - 07:57 AM

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.