Hidiho,
some parts of the 2D graphics I draw using juce::Graphics
with an internal OpenGL graphics context are not visible on screen. It happens both when drawing directly to the screen by creating a LowLevelGraphicsContext
with juce::createOpenGLGraphicsContext
and passing it to a Graphics
constructor, and also when doing offscreen rendering by creating an Image
with OpenGLImageType
and passing that to a Graphics
constructor (and drawing the image afterward using drawImage
).
What I observe is that the “last part of the last primitive” is missing. For testing I’m drawing 4 differently colored ellipses. When I resize the window such that whole primitives are being culled away, only the last visible one is affected. I hope the following screenshots make this more clear.
When I switch the primitive from using fillEllipse
to fillRect
I do not see any output at all.
I dug a little bit into the code and checked which OpenGL calls are being made with RenderDoc. It seems that the primitives on the OpenGL side are drawn in batches of 1536 using glDrawElements
, and for some reason the draw command of the last batch is not issued.
I suspect that there might be a flush of the quad queue missing or getting lost somewhere. If I wrap my rendering calls in a begin/endTransparencyLayer
, which will force a flush as far as I can see, the problems disappear.
If it helps I can provide a minimal example to reproduce the problem.
Thank you and best regards,
Patric