Benchmarking animation: OpenGL vs Juce


#1

Hi there,

I’ve written a small benchmark app for OpenGL vs JUCE and would like someone to verify I am doing things correctly. Main points:
JUCE version:

  • call repaint() in timerCallback() with startTimerHz(1000) to max out frame speed capability
  • call time_frames() in every paint() call.

OpenGL version:

  • using setContinuousRepainting(true)
  • call time_frames() in every renderOpenGL() call.

void MainComponent::time_frames() { const auto current_time = Time::currentTimeMillis(); frame_count++; if (current_time - prev_time >= 1000.0 ){ frame_time = 1000. / frame_count; DBG(String::formatted("%f ms/frame", frame_time)); frame_count = 0; prev_time = current_time; } }
I’m finding JUCE is capped at around 8.3ms/frame with OpenGL getting around 2.3ms/frame.

The full code can be found here:


#2

Ugh no idea why my code formatting turned out that way. Here’s a screen shot of time_frames(), as I mentioned, this is placed in paint() and renderOpenGL()


#3
  • call repaint() in timerCallback() with startTimerHz(1000) to max out frame speed capability

That’s probably far too high. All repaint() does is request a redraw afaik so you’re probably just creating more work.


#4

I could probably lower that to 200 but it doesn’t seem to make a difference to the frame time measured on values from that moment on. Just trying to push the software renderer to its limits with 1000, as I’m assuming that the opengl renderer is already working as fast as it can (as there’s no way to control this other than setSwapInterval() which is already at 0). This is just assumptions though.