I’ve put together a simple adaptive-quality fragment shader example.
The code does not use any external libraries, so it might be educational for those who want to start playing with WebGL.
You can run it from this page: http://guciek.net/en/3d/adaptive_quality_webgl_example
Note that it was specifically meant to be simple!
thanks,…but when I wanted to run I got: Error: Could not compile vertex or fragment shader!. Didn´t investigate it further…
Could you please write what your browser/OS/graphics card/driver configuration is?
I have tested this example on two NVidia cards and the OSMesa renderer, so you are probably using some other card brand. Thanks.
Thanks again. Unfortunately, it is not probable that I will have access to Apple computers anytime soon (well, I can only mess with this in an Apple Store, but this would look strange, hahah).
I don’t want to pursue you, but if you have time, you might try to remove both functions and calls to them from the fragment shader and see if it works then.
I’ve had a quick look at the shaders and it looks like you’re missing quite few “.0” of the end of the floats, macs really don’t like that. eg:
float angle = dot(normalize(vec3(-10, -10, 10)), normalize(norm));
float angle = dot(normalize(vec3(-10.0, -10.0, 10.0)), normalize(norm));
Like you I’ve no mac to test on and I’m forever making that mistake.
You are quite right… I’ve fixed that, so if you could check if it works now…
still not OK:
line 199: - Uncaught TypeError: Cannot call method ‘shaders’ of null
Now I have fixed shader code to pass the newly-introduced validation - maybe this has helped the Mac case? Or changed anything at all?
running on mac nice and smooth
Happy to hear that! Thank you. So it turns out that this validation thing is useful, there should be less trouble with different platforms now!
There’s still issues. You’re using WebGLFloatArray. That is no longer part of the spec. It’s been changed to Float32Array. All of the WebGLXXXArray types have changed names.
Looking forward to checking it out once it’s fixed
@gregg Big thanks for the reminder! This has changed after I last updated this demo.
I fixed it, but I have not yet done any testing on different systems, so at best I can hope this works for you now
It will be nice if you write how it worked after the change and what your specs are.