We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.

Verge3D active even if window loses focus

Home Forums General Questions Verge3D active even if window loses focus

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #17831
    D3Pixel
    Customer

    Hi

    I just noticed that my GPU was running flat out even though the Verge3D browser tab was not in focus or the active application.

    Shouldn’t it automatically disable the renderer when the browser or tab loses focus to save battery power on mobile devices?

    Thanks

    3D Animation and Web3D services - www.d3pixel.co.uk

    #17832

    Hi,

    You can detect if a tab is visible using onblur/onfocus events, and stop or resume the rendering accordingly. To make this work, add the following lines to the runCode function of your application js file:

       window.onfocus = function() {
            app.enableRendering();
        };
    
        window.onblur = function() {
            app.disableRendering(0);
        };
    

    See more on using JavaScript here
    https://www.soft8soft.com/docs/manual/en/introduction/Using-JavaScript.html

    Chief 3D Verger | LinkedIn | Twitter

    #17847
    D3Pixel
    Customer

    Thanks for the quick answer Yuri

    3D Animation and Web3D services - www.d3pixel.co.uk

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.