OpenGL change in behavior between 5.0.1 and 5.1.1?


#1

Hi,
I tried recently one of my OpenGL plugins with JUCE 5.1.1. It raises an assertion in Component::paint (Graphics&), but I don’t know why… As soon as the OpenGL component has a size, the assertion is raised.
Is there something that needs to be added for OpenGL since 5.0.1? I can’t figure out why this fails.


#2

Remove the assert makes the display work, but I’d rather know why there is a need for the assert and how to fix it properly :wink:


#3

Knowing which assertion was raised, as well as what OS you use etc might be useful information.


#4

There is only one in Component::paint: jassert (getBounds().isEmpty() || ! isOpaque());
The bounds are not empty and I don’t know what isOpaque actually checks, as I’m definitely painting something with OpenGL.


#5

Opaque is a flag that you can set. It is used for optimisation, Component::setOpaque():

Components that always paint all of their contents with solid colour and thus completely cover any components behind them should use this method to tell the repaint system that they are opaque.
This information is used to optimise drawing, because it means that objects underneath opaque windows don’t need to be painted.

If your component is opaque, this assert makes sure, that you implemented your own paint() method.

I didn’t use OpenGL manually, so I can’t tell, if it is better to implement an empty paint() or to set the opaque flag to false…

The assert comment suggests overriding paint:

// if your component is marked as opaque, you must implement a paint
// method and ensure that its entire area is completely painted.

HTH


#6

OpenGL component handles paint itself, I have a render method instead.
And definitely not setting that flag myself. So kind of a mystery when this change was introduced!


#7

OK, So I guess no one had issues updating from JUCE 5 to JUCE 5.1??