OpenGL - performance issues


#1

Hi,

I'm trying to use OpenGL to render my own SvgKnob (rotary slider) extending Slider object.

According to that topic:

http://www.juce.com/forum/topic/new-opengl-classes

I'm setting my MainWindow as an OpenGLRenderer, setting openGLContext as follows:

openGLContext.setRenderer (this);
openGLContext.attachTo (*this);
openGLContext.setContinuousRepainting (true);

For testing purposes, there are 40 knobs rendered from SVG to the Drawable objects, randomly changing at 20FPS.

In custom SvgKnobLookAndFeel::drawRotarySlider(..) method, set for SvgKnob, I'm just creating transformation with such code:

AffineTransform t = AffineTransform::rotation(fractRotation * M_PI, 50, 50);
g.addTransform(t);
pointer->draw(g, 1.0);

When debugging - g's low level context is the OpenGLRendering::ShaderContext (it's OK, isn't it?)

Nevertheless - it's not working with 0% CPU as it should - takes sth like 7-10%. Looking at profiler - spending time mostly on starting new Thread - GL thread probably (see shared dropbox link).

https://www.dropbox.com/s/x4wsdtyddrq7nqn/Screenshot%202015-05-14%2015.09.19.png?dl=0

Subtracting the time for creating those threads - there would be almost no delay for GL rendering, as it should be.

What I'm doing wrong? I was trying to attach GL context to knobs separately, but it didn't work (and shouldn't).

Any ideas, hints or proper solutions?

regards

mqqla