I remembered when I set openGLContext.setSwapInterval(0) in void initialise() override; on windows , then fps will be as fast as it can.
But I on my mac catalina version 10.15.5(19f10) , juce version v6.0.4 it wouldn’t work and will always be 60fps.
Is there anyone could tell me what causes the fps limitation? Thanks.
BTW:
I test the fps with the OpenglAppDemo.h
in initialise I add the code openGLContext.setSwapInterval(0);
the whole function looks like
void initialise() override
{
openGLContext.setSwapInterval(0);
createShaders();
}
then I have a fps caculation class like :
class FPS
{
public:
int fps = 0;
FPS()
{
lastTime = Time::getMillisecondCounter();
}
void incFrameCount()
{
frameCount++;
if (Time::getMillisecondCounter() - lastTime > 1000)
{
fps = frameCount;
frameCount = 0;
lastTime = Time::getMillisecondCounter();
}
}
private:
juce::uint32 lastTime; // ms
int frameCount{ 0 };
};
then declare a variable FPS _fps ; in OpenGLAppDemo class.
then in render function I just printout the fps like this:
_fps.incFrameCount();
DBG("SwapInterval :" << openGLContext.getSwapInterval() << " fps:" << _fps.fps);
the whole code is at https://gist.github.com/iomeone/bea5ce29083a391b93ddae3ceaf4dded
if you run the code , the output will be something like this :
SwapInterval :0 fps:61
SwapInterval :0 fps:61
SwapInterval :0 fps:61
SwapInterval :0 fps:61
SwapInterval :0 fps:61
It would be great if someone can point out how to unlock the fps,
