View Full Version : Is texture2D allowed in a *vertex* shader?
12-03-2010, 03:56 AM
Are WebGL vertex shaders allowed to read textures?
12-03-2010, 09:38 PM
Yes and no.
I have certainly gotten vertex shader textures to work just fine on many different driver/browser/hardware/OS combinations.
The WebGL specification says that you can query WebGL to see how many vertex textures are supported - and the answer can legally be (and often is) zero...in which case you don't have vertex textures and you have to figure another way around the problem.
MUCH worse than that is that I have an older WinXP laptop with an nVidia 6100 GO chip in it which reports that one vertex texture is available...but when I use it, the driver seems to fall back to running the vertex shader in the CPU - which takes my frame rate down from 20Hz to about 1Hz!
So if you want both portability and speed - you're kinda screwed right now.
I wound up rewriting my code to avoid vertex textures altogether...but YMMV.
12-04-2010, 06:28 PM
Thanks for the response!
The same shader worked on a desktop application (same hw/driver/os), so I knew that it was either a webgl or browser limitation. It turned out to be a bug with Chrome, as Firefox 4 worked perfectly. Filed a bug here: http://code.google.com/p/chromium/issues/detail?id=65340
Do you, by chance, know what gl call will return the number of vertex textures supported?
12-04-2010, 11:21 PM
n = gl.getParameter(MAX_VERTEX_TEXTURE_IMAGE_UNITS);
12-07-2010, 02:31 PM
Powered by vBulletin® Version 4.2.2 Copyright © 2014 vBulletin Solutions, Inc. All rights reserved.