Read Colour Idx From BitMap


I’m just wandering why I can’t use my own values in texture2D() like below :

texture2D(uSampler, vec2(0.25, 0.25));

I would like to be able to use colour maps from bitmaps (1D or 2D) in rendering Mandelbrot fractals.

The full Code is take from ( … index.html)

Can this be done … Examples AnyOne ??! …

Hi FlemsSolo,

I’m a bit confused – is the code that you give not working for you? It looks fine.



Hi Giles

Sorry for not returning so often to look for replies … And may I just say, that I look in on your LearningWebGL Blog several times a day … it’s a great place for tutorials and news from the WebGl community … Outstanding work …

Yes, the referenced code is okay, but if I want to use my own parameters/variables for texture lookup, as for example the following code ‘texture2D(uSampler, vec2(0.25, 0.25));’ … I get an error …

But maybe I should dig a little deeper into OpenGl to see if I can approach the problem from a wider perspective than that of the ‘Rookie’ …

Keep up the good work …

FlemsSolo, The Rotten State Of Denmark :? …

Hi FlemsSolo,

Sorry for not replying here sooner!


That sounds odd, I’d certainly expect that to work. What’s the exact error message?