Jump to content

Unable to auto-detect a suitable renderer


JeanLouis
 Share

Recommended Posts

Hello

Working on mac OS High Sierra with Brave Version 1.56.20 Chromium: 115.0.5790.171

Workers and offscreen canvas works perfecly
PIXI 7.2.4 works perfectly

Yet, the code below does not work, error : "Unable to auto-detect a suitable renderer".

index.html

<!doctype html>
<html>
  
    <body>
        <script>
            
            const canvas = document.createElement('canvas');
            document.body.appendChild(canvas);
            const view = canvas.transferControlToOffscreen();
            const worker = new Worker('./worker.js');
            worker.postMessage({where:view}, [view]);
            
        </script>
    </body>
</html>

worker.js

self.importScripts("https://cdnjs.cloudflare.com/ajax/libs/pixi.js/7.2.4/pixi.min.js");

self.onmessage = function(args)
{
    const app = new PIXI.Application({ // launches error : "Unable to auto-detect a suitable renderer"
        width:500,
        height:500,
        view:args.data.where
    });

    const container = new PIXI.Container(); // no error, so PIXI is imported successfully
}

Error with the same with others browsers (firefox and safari).

Any ideas ?

Thanks !

Link to comment
Share on other sites

Finally found it, actually the cdn was wrong, you have to use a specific one for workers  https://cdn.jsdelivr.net/npm/@pixi/[email protected]/dist/webworker.min.js");

Would be best if this would be written in the pixi official page if you ask me : https://pixijs.io/examples/#/offscreen-canvas/web-worker.js

Whatever :)

Solved !

Edited by JeanLouis
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...