Point light working
This commit is contained in:
@@ -25,14 +25,14 @@ public:
|
||||
HydraTextureBufferManager *tex_buffer_manager = engine->TextureBufferManager();
|
||||
HydraRenderSettings render_settings = engine->RenderSettings();
|
||||
|
||||
*m_texture_id = tex_buffer_manager->CreateTexture("shadow_FB",
|
||||
SHADOW_MAP_SIZE, SHADOW_MAP_SIZE,
|
||||
GL_RGBA8,
|
||||
GL_NEAREST,
|
||||
GL_NEAREST,
|
||||
1);
|
||||
// *m_texture_id = tex_buffer_manager->CreateTexture("shadow_FB",
|
||||
// SHADOW_MAP_SIZE, SHADOW_MAP_SIZE,
|
||||
// GL_RGBA8,
|
||||
// GL_NEAREST,
|
||||
// GL_NEAREST,
|
||||
// 1);
|
||||
|
||||
HydraTextureBuffer texture = tex_buffer_manager->GetTexture(*m_texture_id);
|
||||
// HydraTextureBuffer texture = tex_buffer_manager->GetTexture(*m_texture_id);
|
||||
|
||||
*m_depth_texture_id = tex_buffer_manager->CreateTexture("shadow_depth_buffer",
|
||||
SHADOW_MAP_SIZE, SHADOW_MAP_SIZE,
|
||||
@@ -45,8 +45,8 @@ public:
|
||||
glGenFramebuffers(1, m_frame_buffer_id);
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, *m_frame_buffer_id);
|
||||
|
||||
glTextureParameteri(texture.gl_tex_id, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
glTextureParameteri(texture.gl_tex_id, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
// glTextureParameteri(texture.gl_tex_id, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
// glTextureParameteri(texture.gl_tex_id, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
|
||||
// FIX 1: Set explicit filters for the depth texture to prevent incomplete attachment
|
||||
glTextureParameteri(depth_texture.gl_tex_id, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
@@ -58,14 +58,14 @@ public:
|
||||
glTextureParameteri(depth_texture.gl_tex_id, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER);
|
||||
glTextureParameterfv(depth_texture.gl_tex_id, GL_TEXTURE_BORDER_COLOR, &border[0]);
|
||||
|
||||
glFramebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, texture.gl_tex_id, 0);
|
||||
//glFramebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, texture.gl_tex_id, 0);
|
||||
glFramebufferTexture(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, depth_texture.gl_tex_id, 0);
|
||||
|
||||
glNamedFramebufferDrawBuffer(*m_frame_buffer_id, GL_COLOR_ATTACHMENT0);
|
||||
glNamedFramebufferReadBuffer(*m_frame_buffer_id, GL_COLOR_ATTACHMENT0);
|
||||
// glNamedFramebufferDrawBuffer(*m_frame_buffer_id, GL_COLOR_ATTACHMENT0);
|
||||
// glNamedFramebufferReadBuffer(*m_frame_buffer_id, GL_COLOR_ATTACHMENT0);
|
||||
|
||||
GLenum draw_buffers[] = {GL_COLOR_ATTACHMENT0};
|
||||
glNamedFramebufferDrawBuffers(*m_frame_buffer_id, 1, draw_buffers);
|
||||
// GLenum draw_buffers[] = {GL_COLOR_ATTACHMENT0};
|
||||
glNamedFramebufferDrawBuffers(*m_frame_buffer_id, 0, nullptr);
|
||||
|
||||
GLenum status = glCheckNamedFramebufferStatus(*m_frame_buffer_id, GL_FRAMEBUFFER);
|
||||
if (status != GL_FRAMEBUFFER_COMPLETE)
|
||||
|
||||
Reference in New Issue
Block a user