I am porting https://learnopengl.com/ to juce (https://github.com/iomeone/openglWithJuce)
Currently woking on https://learnopengl.com/Advanced-OpenGL/Framebuffers .
I’d like to use the built in class OpenGLFrameBuffer in juce since it’s convinient.
But It do not provide a way to set wantsDepthBuffer and wantsStencilBuffer to true.
I’d suggest this function at
https://github.com/WeAreROLI/JUCE/blob/3a4c0f901204a1aeec05597421da80acff403a4a/modules/juce_opengl/opengl/juce_OpenGLFrameBuffer.cpp#L179
could be written to
bool initialise (OpenGLContext& context, int width, int height, bool wantsDepthBuffer=false, bool wantsStencilBuffer = false);
bool OpenGLFrameBuffer::initialise (OpenGLContext& context, int width, int height, bool wantsDepthBuffer, bool wantsStencilBuffer)
{
jassert (context.isActive()); // The context must be active when creating a framebuffer!
pimpl.reset();
pimpl.reset (new Pimpl (context, width, height, wantsDepthBuffer, wantsStencilBuffer));
if (! pimpl->createdOk())
pimpl.reset();
return pimpl != nullptr;
}
(add default argument)
then we have a way to enable stencil and depth buffer!
BTW: use Framebuffers to achieve some post-processing effects is really convient!
like i did in
Just call makeCurrentRenderingTarget
and releaseAsRenderingTarget
, everything done!!