Hitting OpenGL texture assert

Hi,

We’re hitting this assert in an OpenGL application on JUCE 8.0.8 on Windows:

I’ve managed to create a simple JUCE application that triggers the assert. Run this code, hover one of the buttons with the mouse, and the assert should trigger.

struct MainComponent : juce::Component
{
    MainComponent()
    {
        for (int i = 0; i < 20; i++)
        {
            struct Button : juce::DrawableButton
            {
                Button() : DrawableButton("", ImageOnButtonBackground)
                {
                }

                void paint(juce::Graphics& g) override
                {
                    // juce::DrawableButton::paint(g);

                    juce::DrawablePath().drawWithin(g, getLocalBounds().toFloat(), juce::RectanglePlacement::centred, 0.5f);
                }
            };

            buttons.push_back(std::make_unique<Button>());
            addAndMakeVisible(*buttons.back());
        }

        setSize(600, 400);
    }

    void resized() override
    {
        auto r = getLocalBounds();
        for (auto& button : buttons)
        {
            button->setBounds(r.removeFromRight(25));
        }
    }

    struct Renderer : juce::OpenGLRenderer
    {
        Renderer(juce::Component& component)
        {
            context.setRenderer(this);
            context.attachTo(component);
        }
        
        ~Renderer() override
        {
            context.detach();
        }
        
        void newOpenGLContextCreated() override {}
        
        void renderOpenGL() override
        {
            juce::OpenGLHelpers::clear(juce::Colours::red);
        }
        
        void openGLContextClosing() override {}
        
        juce::OpenGLContext context;
    };
    
    Renderer renderer { *this };
    
    std::vector<std::unique_ptr<juce::DrawableButton>> buttons;
};

Please could this bug be fixed?

Best,

Jelle

Can the JUCE team confirm this is a bug?

Thanks for reporting, that’s fixed here:

1 Like