mrdoob/three.js — pull request #923 by greggman (2011-12-17 01:15:47+00:00)
Title: Make three.js autoscale texture to max size of WebGL hardware

This is just a sample, it's up to you if you think it's a good patch.

The issue is there are max sizes on various hardware for textures and cubemaps. Because of bugs in OSX Intel OpenGL drivers both Chrome and Firefox limit the largest cubemap size to 512x512 on that hardware.

So, if you run this sample
http://mrdoob.github.com/three.js/examples/webgl_materials_cars_anaglyph.html

It will fail on any current Macbook Air because the cubemaps are too large.

One solution is to shrink the original cubemaps. Another is to shrink them at runtime which is what this patch does. It would probably be good to do the same for regular textures but unfortunately it's not that simple. If the textures do not use pre-multiplied alpha then you can't use the canvas tag to scale the textures without losing data. One way to handle that might be to track pixelStorei UNPACK_PREMULTIPLY_ALPHA_WEBGL and fail if it's false and if the texture size is too large.

Anyway, this patch should make that sample run on a Intel Macbook Air.

PS: If you want to test on a Macbook Pro or you can run gfxCardStatys
http://codykrieger.com/gfxCardStatus which will let you force your mbp into Intel mode and see the problem. Note: After forcing integrated only you need to re-start the browser.