Почему текстура глубины, прикрепленная к моему FBO, полностью черная? [закрыто] ⇐ C++
Почему текстура глубины, прикрепленная к моему FBO, полностью черная? [закрыто]
I have a framebuffer object (FBO) that I create like so
glGenFramebuffers(1, &m_FBO); glBindFramebuffer(GL_FRAMEBUFFER, m_FBO); auto& window_descriptor = m_WindowManager->GetDescriptor(); glGenTextures(1, &m_FBO_texture); glBindTexture(GL_TEXTURE_2D, m_FBO_texture); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, window_descriptor.width, window_descriptor.height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, m_FBO_texture, 0); glGenTextures(1, &m_FBO_depth_texture); glBindTexture(GL_TEXTURE_2D, m_FBO_depth_texture); glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, window_descriptor.width, window_descriptor.height, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_BYTE, NULL ); glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, m_FBO_depth_texture, 0); if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) { std::cout
Источник: https://stackoverflow.com/questions/781 ... -all-black
I have a framebuffer object (FBO) that I create like so
glGenFramebuffers(1, &m_FBO); glBindFramebuffer(GL_FRAMEBUFFER, m_FBO); auto& window_descriptor = m_WindowManager->GetDescriptor(); glGenTextures(1, &m_FBO_texture); glBindTexture(GL_TEXTURE_2D, m_FBO_texture); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, window_descriptor.width, window_descriptor.height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, m_FBO_texture, 0); glGenTextures(1, &m_FBO_depth_texture); glBindTexture(GL_TEXTURE_2D, m_FBO_depth_texture); glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, window_descriptor.width, window_descriptor.height, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_BYTE, NULL ); glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, m_FBO_depth_texture, 0); if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) { std::cout
Источник: https://stackoverflow.com/questions/781 ... -all-black
-
- Похожие темы
- Ответы
- Просмотры
- Последнее сообщение