Rewritten. Works as a charm now.
This commit is contained in:
@@ -16,6 +16,7 @@ Texture2D::~Texture2D()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
RenderBuffer::~RenderBuffer()
|
||||
{
|
||||
if (m_ResourceHandle != 0) {
|
||||
@@ -51,7 +52,6 @@ void FrameBuffer::Generate()
|
||||
switch ((*it)->m_ResourceType) {
|
||||
case GL_TEXTURE_2D:
|
||||
glFramebufferTexture2D(GL_FRAMEBUFFER, (*it)->m_Attachment, (*it)->m_ResourceType, *(*it)->m_ResourceHandle, 0);
|
||||
attachments.push_back((*it)->m_Attachment);
|
||||
GLERROR("FrameBuffer generate: glFramebufferTexture2D");
|
||||
break;
|
||||
case GL_RENDERBUFFER:
|
||||
@@ -60,13 +60,13 @@ void FrameBuffer::Generate()
|
||||
break;
|
||||
case GL_TEXTURE_2D_ARRAY:
|
||||
glFramebufferTexture(GL_FRAMEBUFFER, (*it)->m_Attachment, *(*it)->m_ResourceHandle, 0);
|
||||
attachments.push_back((*it)->m_Attachment);
|
||||
GLERROR("FrameBuffer generate: GL_TEXTURE_2D_ARRAY");
|
||||
GLERROR("FrameBuffer generate: glFramebufferTexture2DArray");
|
||||
break;
|
||||
}
|
||||
GLERROR("2");
|
||||
|
||||
if ((*it)->m_Attachment != GL_DEPTH_ATTACHMENT && (*it)->m_Attachment != GL_STENCIL_ATTACHMENT && (*it)->m_Attachment != GL_DEPTH_STENCIL_ATTACHMENT) {
|
||||
// Need GL_DEPTH_ATTACHMENT for shadows
|
||||
if (/*(*it)->m_Attachment != GL_DEPTH_ATTACHMENT &&*/ (*it)->m_Attachment != GL_STENCIL_ATTACHMENT && (*it)->m_Attachment != GL_DEPTH_STENCIL_ATTACHMENT) {
|
||||
attachments.push_back((*it)->m_Attachment);
|
||||
}
|
||||
GLERROR("Attachment");
|
||||
@@ -74,19 +74,19 @@ void FrameBuffer::Generate()
|
||||
}
|
||||
GLERROR("3");
|
||||
|
||||
GLenum* bufferTextures = &attachments[0];
|
||||
glDrawBuffers(attachments.size(), bufferTextures);
|
||||
if (GLERROR("GLBufferAttachement error")) {
|
||||
printf(": AttachmentSize %i", attachments.size());
|
||||
}
|
||||
GLenum* bufferTextures = &attachments[0];
|
||||
glDrawBuffers(attachments.size(), bufferTextures);
|
||||
if (GLERROR("GLBufferAttachement error")) {
|
||||
printf(": AttachmentSize %i", attachments.size());
|
||||
}
|
||||
|
||||
if (GLenum frameBufferStatus = glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) {
|
||||
GLERROR("Framebuffer incomplete");
|
||||
//LOG_ERROR("FrameBuffer incomplete: 0x%x\n", frameBufferStatus);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
GLERROR("END");
|
||||
|
||||
if (GLenum frameBufferStatus = glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) {
|
||||
GLERROR("Framebuffer incomplete");
|
||||
//LOG_ERROR("FrameBuffer incomplete: 0x%x\n", frameBufferStatus);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
GLERROR("END");
|
||||
}
|
||||
}
|
||||
|
||||
void FrameBuffer::Bind()
|
||||
|
||||
Reference in New Issue
Block a user