Pixel shader on 2D vector graphics

Thanks!

I’m trying out something similar now, although my situation might be a bit different. Basically I’m trying to achieve Photoshop style blending modes like Vinnie’s layer effects (which was only for the software renderer).

I’m only at the “background layer” portion right now, so inside my GraphicsLayer class I create an OpenGLImageType to render into. Essentially it’s:

void myComponent::paint(Graphics &g)
{
    g.fillAll(Colours::purple);
    
    {
        // creates an OpenGLImageType internally and keeps an Image reference to it
        GraphicsLayer circleLayer(g); 

        // here we draw using the new 'layer' Graphics object
        Graphics layer(circleLayer.getLowLevelContext());
        layer.fillEllipse(50, 50, 100, 100);

        // Once the GraphicsLayer is out of scope it uses g.drawImage() to 
        // put its contents back into the original Graphics context passed to
        // this function
    }
}

But once I delete the context in the GraphicsLayer there’s a GL_INVALID_OPERATION deep inside the OpenGLContext code (specifically when JUCE’s shader queue tries to draw, juce_OpenGLContext.cpp line 1283). Have you encountered this issue when creating contexts to paint into from OpenGLImageType?

I thought maybe it was my internal OpenGLImageType being deleted when the data is trying to be used (since the Image is a member of that GraphicsLayer, so the ref count goes to 0) but preserving the reference count didn’t change anything.