So I have a component with a class declaration like this:
class WaveGraphOpenGL :
public juce::Component,
public juce::OpenGLRenderer
that I want to be able to hide and reveal using setVisible()
. At initialization, the component initializes and displays just fine, I can successfully hide it by calling setVisible(false)
on one of its parent components, but calling setVisible(true)
causes an error. Specifically, newOpenGlContextCreated()
calls a function compileOpenGlShaderPrograms()
taken from @timart tutorial about OpenGL.
This line:
auto shaderProgramAttempt = std::make_unique<juce::OpenGLShaderProgram>(openGLContext);
Creates a std::unique_ptr<juce::OpenGLShaderProgram>
which is then used to reset the component’s shader program like this:
shaderProgram.reset(shaderProgramAttempt.release());
before the projection and view matrices are attached to the shader program. The issue is that shaderProgramAttempt
is nullptr
for some reason. Is this an issue with the openGLContext object or with the shader program itself (or else am I using std::make_unique
incorrectly)? Any insight from people who have dealt with this is much appreciated!