WIP stencil stuff

This commit is contained in:
Tleety
2016-02-04 17:58:36 +01:00
parent 7c582898f4
commit c526a7af55
4 changed files with 71 additions and 7 deletions
+15 -2
View File
@@ -39,10 +39,13 @@ void FrameBuffer::AddResource(std::shared_ptr<BufferResource> resource)
void FrameBuffer::Generate()
{
GLERROR("PRE");
std::vector<GLenum> attachments;
glGenFramebuffers(1, &m_BufferHandle);
glBindFramebuffer(GL_FRAMEBUFFER, m_BufferHandle);
GLERROR("1");
for (auto it = m_Resources.begin(); it != m_Resources.end(); it++) {
switch ((*it)->m_ResourceType) {
@@ -56,20 +59,30 @@ void FrameBuffer::Generate()
GLERROR("FrameBuffer generate: glFramebufferRenderbuffer");
break;
}
if ((*it)->m_Attachment != GL_DEPTH_ATTACHMENT || (*it)->m_Attachment != GL_STENCIL_ATTACHMENT || (*it)->m_Attachment != GL_DEPTH_STENCIL_ATTACHMENT) {
GLERROR("2");
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");
}
GLERROR("3");
GLenum* bufferTextures = &attachments[0];
glDrawBuffers(attachments.size(), bufferTextures);
if(GLERROR("4")) {
printf("hello");
}
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()