To add my two cents: I think your code is still missing the binding of the texture and setting the uniform to the right value (0):
// in paint() texture.bind(); textureUniform->set (0); shader->fillRect (g.getInternalContext(), getLocalBounds()); texture.unbind();
But, yes, ultimately your point remains valid: there is no way to bind things before the fillRect and no way to unbind after the fillRect call. However, at this point that's a limitation of the OpenGLGraphicsContextCustomShader: you can only use shaders which do not depend on the current state of the context. This means that there is no way to currently use textures in the custom shader. It's worth thinking about how we could fix this in the future.
