implement the complete stroke shader with custom blending mode

This commit is contained in:
2017-04-05 15:55:11 +01:00
parent dc693b2232
commit 9a4fd5e5c9
13 changed files with 265 additions and 46 deletions

View File

@@ -69,6 +69,8 @@ bool RTT::create(int width, int height, int tex/* = -1*/)
// glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT, width, height);
// glBindRenderbuffer(GL_RENDERBUFFER, 0);
glGetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING, &oldFboID);
// Create a framebuffer object
glGenFramebuffers(1, &fboID);
glBindFramebuffer(GL_FRAMEBUFFER, fboID);
@@ -94,22 +96,34 @@ bool RTT::create(int width, int height, int tex/* = -1*/)
// Check FBO status
GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
if (status != GL_FRAMEBUFFER_COMPLETE)
LOG("createColorBuffer failed because: %s", err2str(status));
LOG("RTT::create failed because: %s", err2str(status));
// Switch back to window-system-provided framebuffer
glBindFramebuffer(GL_FRAMEBUFFER, 0);
glBindFramebuffer(GL_FRAMEBUFFER, oldFboID);
oldFboID = 0;
return status == GL_FRAMEBUFFER_COMPLETE;
}
void RTT::bindFramebuffer()
{
#ifdef DEBUG
if (bound)
{
LOG("framebuffer bound twice!");
__debugbreak();
}
#endif // _DEBUG
bound = true;
glGetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING, &oldFboID);
glBindFramebuffer(GL_FRAMEBUFFER, fboID);
}
void RTT::unbindFramebuffer()
{
glBindFramebuffer(GL_FRAMEBUFFER, 0);
glBindFramebuffer(GL_FRAMEBUFFER, oldFboID);
oldFboID = 0;
bound = false;
}
void RTT::clear(glm::vec4 color)