Passing a uniform to primitive

1. A concise explanation of the problem you’re experiencing.

I made a primitive using custom webgl code. I was able to render what I wanted with it, but I can’t figure out how to pass data to it in the form of a sampler2D uniform.

I am trying pass a large array to the vertex shader. Is there a way that I can do this by either encoding the data as an image or by using some other method to pass the data as a sampler2D uniform? I searched thru the forum but couldn’t find any examples.

2. A minimal code example. If you’ve found a bug, this helps us reproduce and repair it.

Capture.png shows how I am making the uniform (with a dummy example of a 1-pixel image). Then I set drawCommand.uniformMap = this._uniformMap when the frame state is updated.

I can make triangles and animate them so I know the basic setup of the primitive is correct. But I get an error whenever I try to access a sampler2d uniform.

3. Context. Why do you need to do this? We might know a better way to accomplish your goal.

I can’t do this by using a material because I need the full vertex shader to fragment shader webgl pipeline to create an animation.

4. The Cesium version you’re using, your operating system and browser.

Cesium 1.5, Chrome, Ubuntu 16.04.

Thank you so much.

I figured it out. I needed to return the values in uniformMap as functions. There is a good example here: