Jump to content

Nothing works but all demos do?


Gachl
 Share

Recommended Posts

I'm probably super dumb and overlook some tiny detail that messes up everything I do.
 
Browser:
Firefox 35.0
Chrome 40.0.2214.91 m
 
Code:

<!DOCTYPE html><html>  <head>    <title>Nothing to see here</title>    <style>      body { background-color: #000; }      canvas { background-color: #222; }    </style>  </head>  <body onload="init();">    <div align="center">      <canvas id="game-canvas" width="512" height="384"></canvas>    </div>    <script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>    <script src="pixi.dev.js"></script>    <script type="text/javascript">      <!--      function init()      {        var stage = new PIXI.Stage(0x0168b1);        var renderer = PIXI.autoDetectRenderer(512, 384, $("#game-canvas"));        renderer.render(stage);      }      -->    </script>  </body></html>

This is pretty much the exact code that the first tutorial ever shows.

 

WebGL creation failed and Expected behaviour
 
What I have here is a javascript function called init that is being called by the body onload event which I expect to run after things such as pixi.dev.js and jquery have loaded.
In this init function, I initialise a stage with a specific blue background colour, I retrieve the canvas to render to and I use the autoDetectRenderer method to have it automatically select WebGL or Canvas. Then the stage is rendered.
At this point, when loading the page (in Firefox), I expect the grayish canvas to be completely blue, because I'm rendering an empty blue stage. Instead I got a bunch of error messages:
 

Error: WebGL: Refused to create ANGLE OpenGL context because of blacklisting. pixi.dev.js:5519
Error: WebGL: Refused to create native OpenGL context because of blacklisting. pixi.dev.js:5519
Error: WebGL: WebGL creation failed. pixi.dev.js:5519
Error: WebGL: Refused to create ANGLE OpenGL context because of blacklisting. pixi.dev.js:5519
Error: WebGL: Refused to create native OpenGL context because of blacklisting. pixi.dev.js:5519
Error: WebGL: WebGL creation failed. pixi.dev.js:5519
"Pixi.js v2.2.3 - http://www.pixijs.com/" pixi.dev.js:228

 
It seems that me, a russian and someone over at kitchenpages were the only people on the whole internet with this issue. And theirs isn't even pixi related. Thankfully, the kitchenpage post has led me to the solution: Go to about:config and set webgl.force-enabled to true. I'm confused why I am the only other person with this issue...

 

Anti-aliasing or naw?

 

After correcting the force-enabled value, the errors disappeared, some new ones appeared but those shouldn't actually be errors, more like warnings. I mean, I can render without anti-aliasing, right? Right!?

 

Error: WebGL: Disallowing antialiased backbuffers due to blacklisting. pixi.dev.js:5519
Error: WebGL: Disallowing antialiased backbuffers due to blacklisting. pixi.dev.js:7884
"Pixi.js v2.2.3 - http://www.pixijs.com/" pixi.dev.js:228

 

Turns out I can't. Nothing is being rendered. All I see is the gray defined by css. This was all Firefox so far as Chrome doesn't say anything about it. It's only the gray square of doom and no output at all.

 

So, as you may have guessed, this is my first time using pixi.js or, for that matter, any graphical javascript library. I have no idea what I'm doing wrong nor do I know where to look to figure it out. I've been to several pixi.js demo pages and all of the apps run perfectly fine. I'm sitting here and can't even get an empty stage to render and it's driving me insane.

 

Please help me understand what's going on and why any of this is happening.

 

tl;dr

  1. WebGL in my script only works when setting about:config webgl.force-enable to true, yet all demos work with it set to false. Why?
  2. Nothing is being rendered. Why?
  3. Am I stupid?

Thanks for your replies.

Link to comment
Share on other sites

Your GPU is blacklisted from using WebGL on a browser level. Nothing you do in the config settings will fix this. Buying a new GPU, or possibly upgrading its drivers are the only options to use WebGL.

 

You can still use Pixi, but you should force it to use the Canvas renderer. For some reason autoDetect clearly doesn't work for your set-up, as it's still trying to use WebGL when it should be falling back to Canvas. So instead force it to use Canvas.

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...