开发者

WebGL: Texture access in a vertex shader?

Is it possible to read from a texture in a vertex shader wi开发者_StackOverflow中文版th WebGL?

I wrote a WebGL page (just to try it out) and used Chrome 7 to test it. As soon as I upgraded to Chrome 8, it stopped working. I double checked that webgl is enabled. The error is:

'texture2D': no matching overloaded function found

When I replace the call to texture2D with a constant, it works. Texture access in a fragment shader using the same texture also works.

Anyone have any ideas? I'm particularly thrown by the fact that upgrading Chrome caused it to break.

Update: It works in firefox 4 beta. I reported a bug with Chrome - issue 65340

Update 2: It now works in Firefox and Chrome


Its not really a 'bug' in Chrome.

Vertex texture access is not a required feature of Open GL ES 2, which is the basis of the WebGL specification. I suspect what might be happening is that although your underlying GL driver supports vertex texture access, now you've switched to Chrome its using Angle, and Angle doesn't report that vertex texture access as available.

You can compare your FF and Chrome versions by using Thatcher Ulrich's

http://webgl-bench.appspot.com/

This has the MAX_VERTEX_TEXTURE_IMAGE_UNITS parameter (near the end) Chrome/Angle always reports 0.t

Another thing to check is that you are using the correct texture2D syntax - the spec changed and it may be that FF is stil supporting the older syntax.


It would like to comment, but I don't have the reputation.

As alanatmech said, it might be related to Angle, which forwards all GL calls into DirectX. So it is not a feature dropping and the benefit would be, to have WebGL support on Windows machines without OpenGL Drivers.

You can try to run Chrome with "--use-gl=desktop", so it will use the OpenGL rendering backend instead of Angle. Your site is not working for me with Chrome 8.0.552.215 beta than either, but it doesn't give the error you mentioned, which I do get on Chrome 9.0.597.10 canary build without the flag AND on Minefield.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜