nick.ace Posted February 20, 2016 Share Posted February 20, 2016 Is it possible to render to a custom buffer for post-processing? (i.e., not the depth, normal, or diffuse buffers) Quote Link to comment Share on other sites More sharing options...
Ma-Shell Posted February 21, 2016 Share Posted February 21, 2016 [App.h]: Buffer* mybuffer; Buffer* mainbuffer; Texture* mytexture; Texture* mydepthtexture; [App.cpp, App::Start after context = Context::Create(window);] mainbuffer = Buffer::GetCurrent(); mybuffer = Buffer::Create(context->GetWidth(), context->GetHeight(), 2, 0); mytexture = Texture::Create(context->GetWidth(), context->GetHeight(),Texture::RGBA,0,1,0); mydepthtexture = Texture::Create(context->GetWidth(), context->GetHeight(), Texture::Depth, 0, 1, 0); mytexture->SetFilter(Texture::Smooth); mybuffer->SetColorTexture(foregroundtexture1); mybuffer->SetDepthTexture(foregrounddepthtexture1); mybuffer->Disable(); [when rendering (normally in App::Loop())] world->Update(); Buffer::SetCurrent(mybuffer); mybuffer->Enable(); world->Render(); mybuffer->Disable(); Buffer::SetCurrent(mainbuffer); Quote Link to comment Share on other sites More sharing options...
nick.ace Posted February 21, 2016 Author Share Posted February 21, 2016 Sorry, I think I need to reword my question. I'm trying to write to a custom buffer using a model fragment shader. I want to access this buffer using a post-process shader. Is there a way to do this? Right now the only way I can think of accomplishing this is to cram values into the depth/normal/diffuse buffers, but then that messes up other post-processing effects. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.