opengl-tutorials / ogl

http://www.opengl-tutorial.org
2.71k stars 926 forks source link

glViewport for RTT requires width and height to be double on mac #54

Open hukasu opened 7 years ago

hukasu commented 7 years ago

On my macbook I need to double the width and height passed to the second glViewport on the main loop (right before glUseProgram(quad_programID)), otherwise Suzanne is only rendered on the lower left of the screen. Might be due to retina display.

I know that it might not be something that can be fixed here but having a warning on the code would be helpful to new students.

screen shot 2017-09-13 at 22 42 48
opengl-tutorial commented 7 years ago

This is due to the Retina display. The OS fakes the window size to keep "reasonable" pixel sizes, just like mobile browser advertise small screens at high dpi, and (usually) compensate for this.

See glfwFramebufferSize : http://www.glfw.org/docs/latest/group__window.html#ga0e2637a4161afb283f5300c7f94785c9 , which is the correct way to do.

On Thu, Sep 14, 2017 at 3:47 AM, hukasu notifications@github.com wrote:

On my macbook I need to double the width and height passed to the second glViewport on the main loop (right before glUseProgram(quad_programID)), otherwise Suzanne is only rendered on the lower left of the screen. Might be due to retina display.

I know that it might not be something that can be fixed here but having a warning on the code would be helpful to new students.

[image: screen shot 2017-09-13 at 22 42 48] https://user-images.githubusercontent.com/7583440/30408441-556c18e2-98d5-11e7-932c-bcfd3877d41a.png

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/opengl-tutorials/ogl/issues/54, or mute the thread https://github.com/notifications/unsubscribe-auth/AMF0SdeBGI6MAUIlaPcULZ47014PN5STks5siIXFgaJpZM4PW8KV .

-- You received this message because you are subscribed to the Google Groups "Contact opengl-tutorial.org" group. To unsubscribe from this group and stop receiving emails from it, send an email to contact-opengl-tutorialorg+unsubscribe@googlegroups.com. To post to this group, send email to contact-opengl-tutorialorg@ googlegroups.com. To view this discussion on the web, visit https://groups.google.com/d/ msgid/contact-opengl-tutorialorg/opengl-tutorials/ ogl/issues/54%40github.com https://groups.google.com/d/msgid/contact-opengl-tutorialorg/opengl-tutorials/ogl/issues/54%40github.com?utm_medium=email&utm_source=footer . For more options, visit https://groups.google.com/d/optout.