cs291 ยป

Contents

Enabling WebGL


WebGL is a cross-platform, royalty-free API used to create 3D graphics in a Web browser.

If the demos in our course do not work for you, some troubleshooting tips for the major browser and operating system combinations follow. Alternatively visit http://get.webgl.org/ and follow the instructions there. Not all browsers (yet) support WebGL, see this chart - we tend to recommend Chrome. For mobile device support, see this thread. Many more useful resources for developers can be found here.


Windows

Requirements: Windows Vista / Windows 7-10 with no video card driver older than 2009-01.

Google Chrome

WebGL is enabled by default. If you have latest drivers and updated Chrome version, but WebGL does not work for you, your video card might be blacklisted. See this link for more details. You might want to try adding --enable-webgl --ignore-gpu-blacklist to your Chrome shortcut.

If you want to run code locally, add --allow-file-access-from-files to your shortcut to enable the use of textures on your machine. For any of these shortcut additions, make sure all Chrome processes in the Task Manager are shut down before restarting Chrome. Note that even rebooting won't assure this - chrome.exe processes will often occur on startup. You have to kill these by hand and then run your shortcut. See this page for more details.

One way to avoid having to use the --allow-file-access-from-files option to allow textures is to set up your own local server. See this page for more details.

Firefox

WebGL is enabled by default. All video card vendors other than AMD/ATI, NVIDIA, Intel are blocked. For more information and how to get around it see official Mozilla page.

Internet Explorer

Internet Explorer 11.0 osupports WebGL, and for the most part pretty well. However, we found we needed to hit "refresh" for just about any demo lesson to get it to load, and the FPS demo in unit 1 never loaded properly. For a more stable and seamless experience, download Chrome or FireFox to be able to enjoy the demos and do the exercises.


OS X

Mac OS version 10.6 or newer is required.

Google Chrome

WebGL is enabled by default. If you have latest drivers and updated Chrome version, but WebGL does not work for you, your video card might be blacklisted. See this link for more details. You might want to try and add --enable-webgl --ignore-gpu-blacklist to your Chrome shortcut. If you want to run code locally, add --allow-file-access-from-files to your shortcut to enable the use of textures on your machine. A convenient way to run Chrome with these flags is to use the Mac's built-in Automator program. From the main menu, select a new application. Then choose "Run Shell Script" from the list of actions. In the text window, delete the word "cat" and replace it with

open -a "Google Chrome.app" --args --enable-webgl --ignore-gpu-blacklist --allow-file-access-from-files

Save this in your Applications folder with a name that makes sense to you, like "Google Chrome with WebGL.app". You can put that in your dock in place of Google Chrome, so you can always start Chrome this way. Note that if the system opens Chrome for you, either as a startup process or in response to a click on a web link, it won't use this shortcut. So when you're ready to do development work, quit Chrome and restart it from this link. Note that you can change the icon on your new file by choosing "Get Info" both on Chrome itself and your shortcut, clicking on the icon in Chrome's info box, press command-C to copy, then click on the icon in your shortcut and press command-V to paste. Now your shortcut's icon is the Google Chrome icon.

In some circumstances just quitting Chrome might not be enough to get it to completely shut down. Even rebooting might not do it, particularly if the system starts up Chrome and Chrome-related apps for you. In that case, from the Utilities folder in your Applications choose Activity Monitor, and click on "Process Name" at the top to sort the processes alphabetically. Find anything named "Google Chrome" or "Chrome" or a variant of those, double click each one, and quit them. Then you can use your shortcut to start a new version of Chrome.

According to Google, running your own web server (Apache, MAMP, or the like) should make all of this unnecessary. But some people find that's not the case. If your textures are not loading properly, even if you have your own server running, try using the steps above to start up Chrome with the flags.

Firefox

WebGL is enabled by default. All video card vendors other than AMD/ATI, NVIDIA, Intel are blocked. For more information and how to get around it see official Mozilla page.

Safari

WebGL is disabled by default, but it's possible to enable it on Leopard, Snow Leopard, or Lion.

To enable WebGL support in Safari:

  • Download and install latest Safari (comes already installed on Lion)
  • Open Preferences, click on Advanced tab and check Show Develop menu in menu bar
  • In menu bar make sure Develop->Enable WebGL is checked

Linux

Up to date Linux distribution.


Firefox

WebGL is enabled by default.

Google Chrome & Chromium

WebGL can be disabled by default for some videocards. To force enable it, launch Chrome with flags --enable-webgl --ignore-gpu-blacklist or follow the. You might also check out chrome://gpu/ to see information about your video card and chrome://flags/ to see experimental configuration options. Override software rendering list is the GUI version of disabling blacklisting. You may also see this Chromium wiki for futher information.