detection - how to detect bug on iOS8_beta4 webgl vertex shander sampler2d -
On iOS Beta 4, iPad 2, I have checked some whether the device supports GPU particle simulation.
gl.getParameter (gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS) & gt; = 1 !! Gl.getExtension ('OES_texture_float')
They both say yes, but do not really work. ..
I know how this kind of bug will be detected ... so that I can come back to other things ...
webgl preview and src:
Screenshots:
I use it to detect iOS 8 Beta 4 and earlier ... Is there a better way to detect and fallback?
if (navigator.usager.match (/ (ipod | iphone | ipad) /)) {var usrA = navigator.userAgent; Var info = usrA.match (/ (Opera | Chrome | Safari | Firefox | MSI | Trident (? = \ /)) \ /? * * (\ D +) / i) || []; If (pageflat (notice [2], 10) & lt; = 9537) {check.gpuSim = false; }}
to read thx> v
Check for user agent
to do anything in HTML / Javascript Its being done.
The correct way of his case is whether you make a floating point texture (something that is usually needed for particle simulation). To test if you can render the floating point texture that you need to create a framebuffer, then attach the floating point texture, then check that it is full.
var gl = someCanvasElement.getContext ("experimental-webgl"); Var ext = gl.getExtension ("OES_texture_float"); If (! Ext) {Warning ("no OES_texture_float"); Return; }
Now you can create and render with floating point texture. The next thing is that you can render in the floating point texture.
var tex = gl.createTtexture (); Gl.bindTexture (gl.TEXTURE_2D, tex); Gl.texImage2D (gl.TEXTURE_2D, 0, gl.RGBA, width, height, 0, gl.RGBA, gl.FLOAT, empty); Gl.texParameteri (gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); Gl.texParameteri (gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); Gl.texParameteri (gl.TEXTURE_MIN_FILTER, gl.NEAREST); Gl.texParameteri (gl.TEXTURE_MAG_FILTER, gl.NEAREST); Var fb = gl.createFramebuffer (); Gl.bindFrameBuffer (gl.FRAMEBUFFER, FB); Gl.framebufferTextxture2D (gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, tex, 0); Var position = gl.checkFramebufferStatus (gl.FRAMEBUFFER); If (status! = Gl.FRAMEBUFFER_COMPLETE) {warning ("floating point can not render in texture"); Return; }
In addition, if you use a depth or stencil attachment when rendering that floating point texture, you should also check it before it is complete, to attach the wanted.
Comments
Post a Comment