Adding shaders to the style object in WebGLVectorLayerRenderer?

24 views Asked by At

Upgrading from OpenLayers 7.5.0 to 9.0.0, the earlier spesific style object used in the WebGLVectorLayerRenderer is deprecated, and I am having trouble ajusting to the more standard webGL flat style that is now being used.

Old style:

this.renderer=new WebGLVectorLayerRenderer(this, {
        fill: {
          attributes: {
            color: ...
          },
        },
        stroke: {
          attributes: {
            color: ...
          },
        },
        point:{
            attributes:{
              speed:...
              }
          },
          vertexShader:`
          ...`,

          fragmentShader:`
          ...
          `
      },
});

New flat style:

this.renderer=new WebGLVectorLayerRenderer(this, {
   style:{
       "fill-color": ["get", "COLOR" ],
       "icon-opacity": 0.6,
       "stroke-color":  ["get", "COLOR"],
       "stroke-width": 1.5,
   }
});

Is it still possible to add shaders in the style object (in my case for point) as it was earlier? I see that I could use the WebGLPointsLayerRenderer, which accepts a vertex and fragmend shader in the setup object, but that would limit me to render only points(?). I can see that there exists a shaderBuilder that might be used somehow, but I am very reluctant to setup my shaders using that, compared to providing it in code.

0

There are 0 answers