In the first example, called ch07_webgl, we will create our first WebGL map. We bring our application to its limits, displaying more than 200,000 points on a single map. If you haven't performed this test already, you must be thinking that the magnitude of features will render our application totally unresponsive and useless. Let's make an attempt to perform this test, though. For this example, we only have to modify our map constructor using our new vector layer and the WebGL renderer:
var map = new ol.Map({
target: 'map',
layers: [
[…]
new ol.layer.Vector({
source: new ol.source.Vector({
format: new ol.format.GeoJSON({
defaultDataProjection: 'EPSG:4326'
}),
url: '../../res/switzerland_points_osm.geojson',
attributions: [
new ol.Attribution({
html: 'Switzerland Points © OpenStreetMap Contributors'
})
]
}),
name: 'Switzerland Points'
})
],
[…]
view: new ol.View({
center: [910000, 5900000],
zoom: 9
}),
renderer: 'webgl'
});If you save the example and load it in a browser, you will be able to take a look at all the points that are rendered after some processing time. The map is quite hard to handle on lower scales; however, it is still manageable. When we zoom in and out on higher scales, the map becomes responsive again:

The only reason our application didn't freeze was due to the utilization of the GPU via the WebGL renderer. With proper hardware acceleration, we can display bigger datasets with acceptable performance.
There is only one serious limitation of this renderer: it cannot draw lines or polygons. The library will support such rendering methods over time; however, using vector lines and polygons are currently not supported. Furthermore, if we try to use line and polygon datasets with the WebGL renderer, the application will throw an error and stop running.