WEBGL_draw_buffers: drawBuffersWEBGL() Methode

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

Die WEBGL_draw_buffers.drawBuffersWEBGL() Methode ist Teil der WebGL-API und ermöglicht es Ihnen, die Zeichnungspuffer zu definieren, in die alle Fragmentfarben geschrieben werden.

Diese Methode ist Teil der WEBGL_draw_buffers Erweiterung.

Hinweis: Bei der Verwendung von WebGL2, ist diese Methode standardmäßig als gl.drawBuffers() verfügbar, und die Konstanten heißen gl.COLOR_ATTACHMENT1 usw. ohne das "WEBGL"-Suffix.

Syntax

js
drawBuffersWEBGL(buffers)

Parameter

buffers

Ein Array von GLenum Konstanten, die die Zeichnungspuffer definieren. Mögliche Werte:

  • gl.NONE: Der Fragment-Shader wird in keinen Farb-Puffer geschrieben.
  • gl.BACK: Der Fragment-Shader wird in den hinteren Farb-Puffer geschrieben.
  • ext.COLOR_ATTACHMENT0_WEBGL Der Fragment-Shader wird in den n-ten Farb-Anhang des Framebuffers geschrieben.
  • ext.COLOR_ATTACHMENT1_WEBGL
  • ext.COLOR_ATTACHMENT2_WEBGL
  • ext.COLOR_ATTACHMENT3_WEBGL
  • ext.COLOR_ATTACHMENT4_WEBGL
  • ext.COLOR_ATTACHMENT5_WEBGL
  • ext.COLOR_ATTACHMENT6_WEBGL
  • ext.COLOR_ATTACHMENT7_WEBGL
  • ext.COLOR_ATTACHMENT8_WEBGL
  • ext.COLOR_ATTACHMENT9_WEBGL
  • ext.COLOR_ATTACHMENT10_WEBGL
  • ext.COLOR_ATTACHMENT11_WEBGL
  • ext.COLOR_ATTACHMENT12_WEBGL
  • ext.COLOR_ATTACHMENT13_WEBGL
  • ext.COLOR_ATTACHMENT14_WEBGL
  • ext.COLOR_ATTACHMENT15_WEBGL

Rückgabewert

Keiner (undefined).

Beispiele

Siehe WEBGL_draw_buffers für mehr Kontext mit diesem Beispielcode.

js
ext.drawBuffersWEBGL([
  ext.COLOR_ATTACHMENT0_WEBGL, // gl_FragData[0]
  ext.COLOR_ATTACHMENT1_WEBGL, // gl_FragData[1]
  ext.COLOR_ATTACHMENT2_WEBGL, // gl_FragData[2]
  ext.COLOR_ATTACHMENT3_WEBGL, // gl_FragData[3]
]);

Spezifikationen

Specification
WebGL WEBGL_draw_buffers Khronos Ratified Extension Specification

Browser-Kompatibilität

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
drawBuffersWEBGL

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
No support
No support

Siehe auch