Fill parts of the screen with different color based on x value

Say I have an x value in a normalized coordinates space that I pass as uniform and I want to fill everything on the screen less than the value with one color, and everything larger than the value with a different color.

I wonder if with OpenGL I have to use a screen sized quad for this, or is there a more elegant approach?

Yes, you will have to draw a full-screen quad. Any kind of computational logic like this is going to have to require shader execution, and that’s going to involve either a rendering operation or a compute shader. And rendering will likely go much better for you.

1 Like