files/en-us/web/api/webgl2renderingcontext/index.md
{{APIRef("WebGL")}}{{AvailableInWorkers}}
The WebGL2RenderingContext interface provides the OpenGL ES 3.0 rendering context for the drawing surface of an HTML {{HTMLElement("canvas")}} element.
To get an object of this interface, call {{domxref("HTMLCanvasElement.getContext()", "getContext()")}} on a <canvas> element, supplying "webgl2" as the argument:
const canvas = document.getElementById("myCanvas");
const gl = canvas.getContext("webgl2");
[!NOTE] WebGL 2 is an extension to WebGL 1. The
WebGL2RenderingContextinterface implements all members of the {{domxref("WebGLRenderingContext")}} interface. Some methods of the WebGL 1 context can accept additional values when used in a WebGL 2 context. You will find this info noted on the WebGL 1 reference pages.
The WebGL tutorial has more information, examples, and resources on how to get started with WebGL.
See the WebGL constants page.
target.WebGLFramebuffer into an existing 3D texture sub-image.WebGL2RenderingContext.uniform[1234][uif][v]()
Methods for working with {{domxref("WebGLQuery")}} objects.
true if a given object is a valid {{domxref("WebGLQuery")}} object.true if a given object is a valid {{domxref("WebGLSampler")}} object.true if the passed object is a valid {{domxref("WebGLSync")}} object.true if the passed object is a valid {{domxref("WebGLTransformFeedback")}} object.target) at a given index.target) at a given index.Methods for working with {{domxref("WebGLVertexArrayObject")}} (VAO) objects.
true if a given object is a valid {{domxref("WebGLVertexArrayObject")}}.{{Specifications}}
{{Compat}}