Drawing lines and polygons with WebGL
In the previous example, we stated that OpenLayers 3 cannot render lines and polygons with the WebGL renderer. However, there is a workaround, which we will use in this example, called ch07_webgl_vector
.
Let's add the country boundaries layer with a little twist to our map:
var map = new ol.Map({ […] new ol.layer.Image({ source: new ol.source.ImageVector({ source: new ol.source.Vector({ format: new ol.format.GeoJSON({ defaultDataProjection: 'EPSG:4326' }), url: '../../res/world_countries.geojson', attributions: [ new ol.Attribution({ html: 'World Countries © Natural Earth' }) ] }) }), name: 'World Countries' }) ], […]
As you can see, we converted our vector layer to...