GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Products
  • Pricing
  • Documentation
  • Get Started with Google Maps Platform
  • Capabilities Explorer
  • Pricing & Billing
  • Security & Compliance
  • Reporting & Monitoring
  • FAQ
  • Support and Resources
  • Customer Care
  • Incident Management
  • Maps JavaScript API
  • Maps SDK for Android

This view

  • Original page
  • New address

GeezerVison is showing developers.google.com — WebGL | Maps JavaScript API | Google for Developers

reviews Get a Maps Demo Key: Try out select Maps JavaScript API and Places UI Kit features at no cost with a Maps Demo Key—no billing information required.

WebGL Stay organized with collections Save and categorize content based on your preferences.

WebGLOverlayView class

class google.maps.WebGLOverlayView extends MVCObject
library "maps"

The WebGL Overlay View provides direct access to the same WebGL rendering context Google Maps Platform uses to render the vector basemap. This use of a shared rendering context provides benefits such as depth occlusion with 3D building geometry, and the ability to sync 2D/3D content with basemap rendering.

With WebGL Overlay View you can add content to your maps using WebGL directly, or popular Graphics libraries like Three.js or deck.gl. To use the overlay, you can extend google.maps.WebGLOverlayView and provide an implementation for each of the following lifecycle hooks: WebGLOverlayView.onAdd, WebGLOverlayView.onContextRestored, WebGLOverlayView.onDraw, WebGLOverlayView.onContextLost and WebGLOverlayView.onRemove.

You must call WebGLOverlayView.setMap with a valid Map object to trigger the call to the onAdd() method and setMap(null) in order to trigger the onRemove() method. The setMap() method can be called at the time of construction or at any point afterward when the overlay should be re-shown after removing. The onDraw() method will then be called whenever a map property changes that could change the position of the element, such as zoom, center, or map type. WebGLOverlayView may only be added to a vector map having a MapOptions.mapId (including maps set to the RenderingType.VECTOR MapOptions.renderingType and using Map.DEMO_MAP_ID as the MapOptions.mapId).

const {WebGLOverlayView} = await google.maps.importLibrary("maps");

Constructor

WebGLOverlayView
WebGLOverlayView()
Parameters: None
Creates a WebGLOverlayView.

Methods

getMap
getMap()
Parameters: None
Return Value: Map|null|undefined
onAdd
onAdd()
Parameters: None
Return Value: None
Implement this method to fetch or create intermediate data structures before the overlay is drawn that don’t require immediate access to the WebGL rendering context. This method must be implemented to render.
onContextLost
onContextLost()
Parameters: None
Return Value: None
This method is called when the rendering context is lost for any reason, and is where you should clean up any pre-existing GL state, since it is no longer needed.
onContextRestored
onContextRestored(options)
Parameters:
  • options: WebGLStateOptions that allow developers to restore the GL context.
Return Value: None
This method is called once the rendering context is available. Use it to initialize or bind any WebGL state such as shaders or buffer objects.
onDraw
onDraw(options)
Parameters:
  • options: WebGLDrawOptions that allow developers to render content to an associated Google basemap.
Return Value: None
Implement this method to draw WebGL content directly on the map. Note that if the overlay needs a new frame drawn then call WebGLOverlayView.requestRedraw.
onRemove
onRemove()
Parameters: None
Return Value: None
This method is called when the overlay is removed from the map with WebGLOverlayView.setMap(null), and is where you should remove all intermediate objects. This method must be implemented to render.
onStateUpdate
onStateUpdate(options)
Parameters:
  • options: WebGLStateOptions that allow developerse to restore the GL context.
Return Value: None
Implement this method to handle any GL state updates outside of the render animation frame.
requestRedraw
requestRedraw()
Parameters: None
Return Value: None
Triggers the map to redraw a frame.
requestStateUpdate
requestStateUpdate()
Parameters: None
Return Value: None
Triggers the map to update GL state.
setMap
setMap([map])
Parameters:
  • map: Map optional The map to access the div, model and view state.
Return Value: None
Adds the overlay to the map.
Inherited: addListener, bindTo, get, notify, set, setValues, unbind, unbindAll

WebGLDrawOptions interface

interface google.maps.WebGLDrawOptions

Drawing options.

Properties

gl
Type: WebGLRenderingContext
The WebGLRenderingContext on which to render this WebGLOverlayView.
transformer
Type: CoordinateTransformer
The matrix transformation from camera space to latitude/longitude coordinates.

WebGLStateOptions interface

interface google.maps.WebGLStateOptions

GL state options.

Properties

gl
Type: WebGLRenderingContext
The WebGLRenderingContext on which to render this WebGLOverlayView.

CoordinateTransformer interface

interface google.maps.CoordinateTransformer

This interface provides convenience methods for generating matrices to use for rendering WebGL scenes on top of the Google base map.

Note: A reference to this object should not be held outside of the scope of the encapsulating WebGLOverlayView.onDraw call.

Methods

fromLatLngAltitude
fromLatLngAltitude(latLngAltitude[, rotations, scale])
Parameters:
  • latLngAltitude: LatLngAltitude|LatLngAltitudeLiteral Latitude, longitude, and altitude.
  • rotations: Float32Array optional An array that contains an Euler rotation angle in degrees, in the XYZ convention.
  • scale: Float32Array optional Array that contains an XYZ scalar array to apply to the cardinal axis.
Return Value: Float64Array MVP matrix to use with WebGL.
getCameraParams
getCameraParams()
Parameters: None
Return Value: CameraParams camera parameters

CameraParams interface

interface google.maps.CameraParams extends CameraOptions

Used for retrieving camera parameters, such as that of the GL camera used for the WebGLOverlayView.

Properties

center
Type: LatLng
heading
Type: number
tilt
Type: number
zoom
Type: number

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2026-11-09 UTC.

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.