Omnimaga

General Discussion => Technology and Development => Web Programming and Design => Topic started by: Sorunome on November 09, 2012, 09:24:51 pm

Title: WebGL Browser support
Post by: Sorunome on November 09, 2012, 09:24:51 pm
Hey, I wanted to start and so some awesome stuff with WebGL but it looks as if my browser doesn't support it.
I have Chromium, this version: Version 22.0.1229.94 (161065) and i'm running on archlinux
my html code looks like this (from a tutorial to test if it's working):
Code: [Select]
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
function initWebGL(canvas) {
// Initialize the global variable gl to null.
gl = null;

try {
// Try to grab the standard context. If it fails, fallback to experimental.
gl = canvas.getContext("webgl") || canvas.getContext("experimental-webgl");
}
catch(e) {}

// If we don't have a GL context, give up now
if (!gl) {
alert("Unable to initialize WebGL. Your browser may not support it.");
}
}
function doFirst() {
var canvas = document.getElementById("canvas");

initWebGL(canvas);      // Initialize the GL context

// Only continue if WebGL is available and working

if (gl) {
gl.clearColor(0.0, 0.0, 0.0, 1.0);                      // Set clear color to black, fully opaque
gl.enable(gl.DEPTH_TEST);                               // Enable depth testing
gl.depthFunc(gl.LEQUAL);                                // Near things obscure far things
gl.clear(gl.COLOR_BUFFER_BIT|gl.DEPTH_BUFFER_BIT);      // Clear the color as well as the depth buffer.
}
}
window.addEventListener('load',doFirst,false);
</script>
</head>
<body onload="start()">
<canvas id="canvas" width="640" height="480">
Internet explorer SUCKS! :P
</canvas>
</body>
</html>
Title: Re: WebGL Browser support
Post by: Deep Toaster on November 09, 2012, 09:32:40 pm
Does it pop up with the error message? It works fine for me in Chrome (beta channel).

Chrome should support WebGL since version 9.
Title: Re: WebGL Browser support
Post by: Sorunome on November 09, 2012, 09:36:37 pm
yeah, the error message popus up
Title: Re: WebGL Browser support
Post by: Deep Toaster on November 09, 2012, 09:39:45 pm
Maybe the Linux build of Chrome doesn't support WebGL? Though I can't see a reason why not.

EDIT: Is WebGL disabled in chrome://flags/?
Title: Re: WebGL Browser support
Post by: Sorunome on November 09, 2012, 09:41:48 pm
it was deactivated, activated and thought woot, but that popup is still coming -.-
Title: Re: WebGL Browser support
Post by: Deep Toaster on November 09, 2012, 09:52:49 pm
You un-checked the checkbox, right?

And did you restart Chrome afterwards?
Title: Re: WebGL Browser support
Post by: willrandship on November 09, 2012, 11:50:54 pm
Do you have 3D graphics acceleration?
Title: Re: WebGL Browser support
Post by: Sorunome on November 10, 2012, 02:30:09 am
@dt yes
and @willrandship: how do i find out?
Title: Re: WebGL Browser support
Post by: willrandship on November 10, 2012, 02:32:04 am
easiest way:

glxinfo | grep rendering

it should say:

Direct Rendering: Yes

which means you have 3D acceleration. If it says no, you don't, and it's probably a driver issue.

It might get some other stuff too, but only the Direct Rendering line matters.
Title: Re: WebGL Browser support
Post by: Sorunome on November 10, 2012, 02:37:03 am
sorunome-laptop% glxinfo | grep rendering
direct rendering: Yes

What's then the problem? D:
Title: Re: WebGL Browser support
Post by: willrandship on November 10, 2012, 02:43:13 am
Hmmmmm.....

I'm assuming you have a method of installing packages from the AUR. If so, try installing google-chrome. That will be the official build, so it has the flash plugin, and it might handle webGL a bit differently. Worth a try, at least.
Title: Re: WebGL Browser support
Post by: Sorunome on November 10, 2012, 02:44:16 am
meh, i'd prefer a chromium solution as i love it, you know...... :(
Title: Re: WebGL Browser support
Post by: willrandship on November 10, 2012, 02:48:12 am
Well, whatever.

What video card do you have? Is it an nvidia video card?
Title: Re: WebGL Browser support
Post by: Sorunome on November 10, 2012, 02:51:16 am
i am not sure, i didn't pay attention to hardware when buying the laptop D:
Title: Re: WebGL Browser support
Post by: willrandship on November 10, 2012, 02:51:56 am
run this, please.

lspci | grep VGA

Title: Re: WebGL Browser support
Post by: Sorunome on November 10, 2012, 02:53:13 am
sorunome-laptop% lspci | grep VGA
00:01.0 VGA compatible controller: Advanced Micro Devices [AMD] nee ATI Wrestler [Radeon HD 6310]
Title: Re: WebGL Browser support
Post by: willrandship on November 10, 2012, 02:55:12 am
Ok.

Try running this and see if webGL runs in the window that comes up.

chromium %U --ignore-gpu-blacklist
Title: Re: WebGL Browser support
Post by: Sorunome on November 10, 2012, 02:59:09 am
nope, still not working
Title: Re: WebGL Browser support
Post by: willrandship on November 10, 2012, 03:01:55 am
Hmmm.....if you want to you could try installing the catalyst drivers.

https://wiki.archlinux.org/index.php/AMD_Catalyst (https://wiki.archlinux.org/index.php/AMD_Catalyst)

For now, I'm off to bed.
Title: Re: WebGL Browser support
Post by: Sorunome on November 11, 2012, 07:24:54 pm
well, if it is so complicated to get it working i don't really wanne do to much with it, so is it somehow possible to recalculate out of x/y/z the new x/y and scale for 3d?
How? :D
Thanks in advice ;)