JoeyDeVries / LearnOpenGL

Code repository of all OpenGL chapters from the book and its accompanying website https://learnopengl.com
https://learnopengl.com
Other
10.86k stars 2.78k forks source link

Depth map only rendered on 1/4 screen #139

Open xchhuang opened 5 years ago

xchhuang commented 5 years ago

Hi all,

I try to render the depth buffer following the "shadow mapping depth" tutorial and source code, and here is my code (with some modifications based on the original code).

However, the result looks like this: the depth map seems work but it only shows up on half of the screen. Does anyone have an idea how to solve it ? I am running on macOS High Sierra and thanks in advance.

image

qszhu commented 1 year ago

The issue only occurs on a retina display (https://github.com/JoeyDeVries/LearnOpenGL/issues/98#issuecomment-364618401). You'll need to use glfwGetFramebufferSize(window, &width, &height) to get the actual framebuffer size.

Alternatively, you could just add glfwWindowHint(GLFW_COCOA_RETINA_FRAMEBUFFER, GL_FALSE).