1// GENERATED CONTENT - DO NOT EDIT 2// Content was automatically extracted by Reffy into webref 3// (https://github.com/w3c/webref) 4// Source: WebGL Specification (https://www.khronos.org/registry/webgl/specs/latest/1.0/) 5 6typedef unsigned long GLenum; 7typedef boolean GLboolean; 8typedef unsigned long GLbitfield; 9typedef byte GLbyte; /* 'byte' should be a signed 8 bit type. */ 10typedef short GLshort; 11typedef long GLint; 12typedef long GLsizei; 13typedef long long GLintptr; 14typedef long long GLsizeiptr; 15// Ideally the typedef below would use 'unsigned byte', but that doesn't currently exist in Web IDL. 16typedef octet GLubyte; /* 'octet' should be an unsigned 8 bit type. */ 17typedef unsigned short GLushort; 18typedef unsigned long GLuint; 19typedef unrestricted float GLfloat; 20typedef unrestricted float GLclampf; 21 22// The power preference settings are documented in the WebGLContextAttributes 23// section of the specification. 24enum WebGLPowerPreference { "default", "low-power", "high-performance" }; 25 26dictionary WebGLContextAttributes { 27 boolean alpha = true; 28 boolean depth = true; 29 boolean stencil = false; 30 boolean antialias = true; 31 boolean premultipliedAlpha = true; 32 boolean preserveDrawingBuffer = false; 33 WebGLPowerPreference powerPreference = "default"; 34 boolean failIfMajorPerformanceCaveat = false; 35 boolean desynchronized = false; 36}; 37 38[Exposed=(Window,Worker)] 39interface WebGLObject { 40}; 41 42[Exposed=(Window,Worker)] 43interface WebGLBuffer : WebGLObject { 44}; 45 46[Exposed=(Window,Worker)] 47interface WebGLFramebuffer : WebGLObject { 48}; 49 50[Exposed=(Window,Worker)] 51interface WebGLProgram : WebGLObject { 52}; 53 54[Exposed=(Window,Worker)] 55interface WebGLRenderbuffer : WebGLObject { 56}; 57 58[Exposed=(Window,Worker)] 59interface WebGLShader : WebGLObject { 60}; 61 62[Exposed=(Window,Worker)] 63interface WebGLTexture : WebGLObject { 64}; 65 66[Exposed=(Window,Worker)] 67interface WebGLUniformLocation { 68}; 69 70[Exposed=(Window,Worker)] 71interface WebGLActiveInfo { 72 readonly attribute GLint size; 73 readonly attribute GLenum type; 74 readonly attribute DOMString name; 75}; 76 77[Exposed=(Window,Worker)] 78interface WebGLShaderPrecisionFormat { 79 readonly attribute GLint rangeMin; 80 readonly attribute GLint rangeMax; 81 readonly attribute GLint precision; 82}; 83 84typedef (ImageBitmap or 85 ImageData or 86 HTMLImageElement or 87 HTMLCanvasElement or 88 HTMLVideoElement or 89 OffscreenCanvas) TexImageSource; 90 91typedef ([AllowShared] Float32Array or sequence<GLfloat>) Float32List; 92typedef ([AllowShared] Int32Array or sequence<GLint>) Int32List; 93 94interface mixin WebGLRenderingContextBase 95{ 96 97 /* ClearBufferMask */ 98 const GLenum DEPTH_BUFFER_BIT = 0x00000100; 99 const GLenum STENCIL_BUFFER_BIT = 0x00000400; 100 const GLenum COLOR_BUFFER_BIT = 0x00004000; 101 102 /* BeginMode */ 103 const GLenum POINTS = 0x0000; 104 const GLenum LINES = 0x0001; 105 const GLenum LINE_LOOP = 0x0002; 106 const GLenum LINE_STRIP = 0x0003; 107 const GLenum TRIANGLES = 0x0004; 108 const GLenum TRIANGLE_STRIP = 0x0005; 109 const GLenum TRIANGLE_FAN = 0x0006; 110 111 /* AlphaFunction (not supported in ES20) */ 112 /* NEVER */ 113 /* LESS */ 114 /* EQUAL */ 115 /* LEQUAL */ 116 /* GREATER */ 117 /* NOTEQUAL */ 118 /* GEQUAL */ 119 /* ALWAYS */ 120 121 /* BlendingFactorDest */ 122 const GLenum ZERO = 0; 123 const GLenum ONE = 1; 124 const GLenum SRC_COLOR = 0x0300; 125 const GLenum ONE_MINUS_SRC_COLOR = 0x0301; 126 const GLenum SRC_ALPHA = 0x0302; 127 const GLenum ONE_MINUS_SRC_ALPHA = 0x0303; 128 const GLenum DST_ALPHA = 0x0304; 129 const GLenum ONE_MINUS_DST_ALPHA = 0x0305; 130 131 /* BlendingFactorSrc */ 132 /* ZERO */ 133 /* ONE */ 134 const GLenum DST_COLOR = 0x0306; 135 const GLenum ONE_MINUS_DST_COLOR = 0x0307; 136 const GLenum SRC_ALPHA_SATURATE = 0x0308; 137 /* SRC_ALPHA */ 138 /* ONE_MINUS_SRC_ALPHA */ 139 /* DST_ALPHA */ 140 /* ONE_MINUS_DST_ALPHA */ 141 142 /* BlendEquationSeparate */ 143 const GLenum FUNC_ADD = 0x8006; 144 const GLenum BLEND_EQUATION = 0x8009; 145 const GLenum BLEND_EQUATION_RGB = 0x8009; /* same as BLEND_EQUATION */ 146 const GLenum BLEND_EQUATION_ALPHA = 0x883D; 147 148 /* BlendSubtract */ 149 const GLenum FUNC_SUBTRACT = 0x800A; 150 const GLenum FUNC_REVERSE_SUBTRACT = 0x800B; 151 152 /* Separate Blend Functions */ 153 const GLenum BLEND_DST_RGB = 0x80C8; 154 const GLenum BLEND_SRC_RGB = 0x80C9; 155 const GLenum BLEND_DST_ALPHA = 0x80CA; 156 const GLenum BLEND_SRC_ALPHA = 0x80CB; 157 const GLenum CONSTANT_COLOR = 0x8001; 158 const GLenum ONE_MINUS_CONSTANT_COLOR = 0x8002; 159 const GLenum CONSTANT_ALPHA = 0x8003; 160 const GLenum ONE_MINUS_CONSTANT_ALPHA = 0x8004; 161 const GLenum BLEND_COLOR = 0x8005; 162 163 /* Buffer Objects */ 164 const GLenum ARRAY_BUFFER = 0x8892; 165 const GLenum ELEMENT_ARRAY_BUFFER = 0x8893; 166 const GLenum ARRAY_BUFFER_BINDING = 0x8894; 167 const GLenum ELEMENT_ARRAY_BUFFER_BINDING = 0x8895; 168 169 const GLenum STREAM_DRAW = 0x88E0; 170 const GLenum STATIC_DRAW = 0x88E4; 171 const GLenum DYNAMIC_DRAW = 0x88E8; 172 173 const GLenum BUFFER_SIZE = 0x8764; 174 const GLenum BUFFER_USAGE = 0x8765; 175 176 const GLenum CURRENT_VERTEX_ATTRIB = 0x8626; 177 178 /* CullFaceMode */ 179 const GLenum FRONT = 0x0404; 180 const GLenum BACK = 0x0405; 181 const GLenum FRONT_AND_BACK = 0x0408; 182 183 /* DepthFunction */ 184 /* NEVER */ 185 /* LESS */ 186 /* EQUAL */ 187 /* LEQUAL */ 188 /* GREATER */ 189 /* NOTEQUAL */ 190 /* GEQUAL */ 191 /* ALWAYS */ 192 193 /* EnableCap */ 194 /* TEXTURE_2D */ 195 const GLenum CULL_FACE = 0x0B44; 196 const GLenum BLEND = 0x0BE2; 197 const GLenum DITHER = 0x0BD0; 198 const GLenum STENCIL_TEST = 0x0B90; 199 const GLenum DEPTH_TEST = 0x0B71; 200 const GLenum SCISSOR_TEST = 0x0C11; 201 const GLenum POLYGON_OFFSET_FILL = 0x8037; 202 const GLenum SAMPLE_ALPHA_TO_COVERAGE = 0x809E; 203 const GLenum SAMPLE_COVERAGE = 0x80A0; 204 205 /* ErrorCode */ 206 const GLenum NO_ERROR = 0; 207 const GLenum INVALID_ENUM = 0x0500; 208 const GLenum INVALID_VALUE = 0x0501; 209 const GLenum INVALID_OPERATION = 0x0502; 210 const GLenum OUT_OF_MEMORY = 0x0505; 211 212 /* FrontFaceDirection */ 213 const GLenum CW = 0x0900; 214 const GLenum CCW = 0x0901; 215 216 /* GetPName */ 217 const GLenum LINE_WIDTH = 0x0B21; 218 const GLenum ALIASED_POINT_SIZE_RANGE = 0x846D; 219 const GLenum ALIASED_LINE_WIDTH_RANGE = 0x846E; 220 const GLenum CULL_FACE_MODE = 0x0B45; 221 const GLenum FRONT_FACE = 0x0B46; 222 const GLenum DEPTH_RANGE = 0x0B70; 223 const GLenum DEPTH_WRITEMASK = 0x0B72; 224 const GLenum DEPTH_CLEAR_VALUE = 0x0B73; 225 const GLenum DEPTH_FUNC = 0x0B74; 226 const GLenum STENCIL_CLEAR_VALUE = 0x0B91; 227 const GLenum STENCIL_FUNC = 0x0B92; 228 const GLenum STENCIL_FAIL = 0x0B94; 229 const GLenum STENCIL_PASS_DEPTH_FAIL = 0x0B95; 230 const GLenum STENCIL_PASS_DEPTH_PASS = 0x0B96; 231 const GLenum STENCIL_REF = 0x0B97; 232 const GLenum STENCIL_VALUE_MASK = 0x0B93; 233 const GLenum STENCIL_WRITEMASK = 0x0B98; 234 const GLenum STENCIL_BACK_FUNC = 0x8800; 235 const GLenum STENCIL_BACK_FAIL = 0x8801; 236 const GLenum STENCIL_BACK_PASS_DEPTH_FAIL = 0x8802; 237 const GLenum STENCIL_BACK_PASS_DEPTH_PASS = 0x8803; 238 const GLenum STENCIL_BACK_REF = 0x8CA3; 239 const GLenum STENCIL_BACK_VALUE_MASK = 0x8CA4; 240 const GLenum STENCIL_BACK_WRITEMASK = 0x8CA5; 241 const GLenum VIEWPORT = 0x0BA2; 242 const GLenum SCISSOR_BOX = 0x0C10; 243 /* SCISSOR_TEST */ 244 const GLenum COLOR_CLEAR_VALUE = 0x0C22; 245 const GLenum COLOR_WRITEMASK = 0x0C23; 246 const GLenum UNPACK_ALIGNMENT = 0x0CF5; 247 const GLenum PACK_ALIGNMENT = 0x0D05; 248 const GLenum MAX_TEXTURE_SIZE = 0x0D33; 249 const GLenum MAX_VIEWPORT_DIMS = 0x0D3A; 250 const GLenum SUBPIXEL_BITS = 0x0D50; 251 const GLenum RED_BITS = 0x0D52; 252 const GLenum GREEN_BITS = 0x0D53; 253 const GLenum BLUE_BITS = 0x0D54; 254 const GLenum ALPHA_BITS = 0x0D55; 255 const GLenum DEPTH_BITS = 0x0D56; 256 const GLenum STENCIL_BITS = 0x0D57; 257 const GLenum POLYGON_OFFSET_UNITS = 0x2A00; 258 /* POLYGON_OFFSET_FILL */ 259 const GLenum POLYGON_OFFSET_FACTOR = 0x8038; 260 const GLenum TEXTURE_BINDING_2D = 0x8069; 261 const GLenum SAMPLE_BUFFERS = 0x80A8; 262 const GLenum SAMPLES = 0x80A9; 263 const GLenum SAMPLE_COVERAGE_VALUE = 0x80AA; 264 const GLenum SAMPLE_COVERAGE_INVERT = 0x80AB; 265 266 /* GetTextureParameter */ 267 /* TEXTURE_MAG_FILTER */ 268 /* TEXTURE_MIN_FILTER */ 269 /* TEXTURE_WRAP_S */ 270 /* TEXTURE_WRAP_T */ 271 272 const GLenum COMPRESSED_TEXTURE_FORMATS = 0x86A3; 273 274 /* HintMode */ 275 const GLenum DONT_CARE = 0x1100; 276 const GLenum FASTEST = 0x1101; 277 const GLenum NICEST = 0x1102; 278 279 /* HintTarget */ 280 const GLenum GENERATE_MIPMAP_HINT = 0x8192; 281 282 /* DataType */ 283 const GLenum BYTE = 0x1400; 284 const GLenum UNSIGNED_BYTE = 0x1401; 285 const GLenum SHORT = 0x1402; 286 const GLenum UNSIGNED_SHORT = 0x1403; 287 const GLenum INT = 0x1404; 288 const GLenum UNSIGNED_INT = 0x1405; 289 const GLenum FLOAT = 0x1406; 290 291 /* PixelFormat */ 292 const GLenum DEPTH_COMPONENT = 0x1902; 293 const GLenum ALPHA = 0x1906; 294 const GLenum RGB = 0x1907; 295 const GLenum RGBA = 0x1908; 296 const GLenum LUMINANCE = 0x1909; 297 const GLenum LUMINANCE_ALPHA = 0x190A; 298 299 /* PixelType */ 300 /* UNSIGNED_BYTE */ 301 const GLenum UNSIGNED_SHORT_4_4_4_4 = 0x8033; 302 const GLenum UNSIGNED_SHORT_5_5_5_1 = 0x8034; 303 const GLenum UNSIGNED_SHORT_5_6_5 = 0x8363; 304 305 /* Shaders */ 306 const GLenum FRAGMENT_SHADER = 0x8B30; 307 const GLenum VERTEX_SHADER = 0x8B31; 308 const GLenum MAX_VERTEX_ATTRIBS = 0x8869; 309 const GLenum MAX_VERTEX_UNIFORM_VECTORS = 0x8DFB; 310 const GLenum MAX_VARYING_VECTORS = 0x8DFC; 311 const GLenum MAX_COMBINED_TEXTURE_IMAGE_UNITS = 0x8B4D; 312 const GLenum MAX_VERTEX_TEXTURE_IMAGE_UNITS = 0x8B4C; 313 const GLenum MAX_TEXTURE_IMAGE_UNITS = 0x8872; 314 const GLenum MAX_FRAGMENT_UNIFORM_VECTORS = 0x8DFD; 315 const GLenum SHADER_TYPE = 0x8B4F; 316 const GLenum DELETE_STATUS = 0x8B80; 317 const GLenum LINK_STATUS = 0x8B82; 318 const GLenum VALIDATE_STATUS = 0x8B83; 319 const GLenum ATTACHED_SHADERS = 0x8B85; 320 const GLenum ACTIVE_UNIFORMS = 0x8B86; 321 const GLenum ACTIVE_ATTRIBUTES = 0x8B89; 322 const GLenum SHADING_LANGUAGE_VERSION = 0x8B8C; 323 const GLenum CURRENT_PROGRAM = 0x8B8D; 324 325 /* StencilFunction */ 326 const GLenum NEVER = 0x0200; 327 const GLenum LESS = 0x0201; 328 const GLenum EQUAL = 0x0202; 329 const GLenum LEQUAL = 0x0203; 330 const GLenum GREATER = 0x0204; 331 const GLenum NOTEQUAL = 0x0205; 332 const GLenum GEQUAL = 0x0206; 333 const GLenum ALWAYS = 0x0207; 334 335 /* StencilOp */ 336 /* ZERO */ 337 const GLenum KEEP = 0x1E00; 338 const GLenum REPLACE = 0x1E01; 339 const GLenum INCR = 0x1E02; 340 const GLenum DECR = 0x1E03; 341 const GLenum INVERT = 0x150A; 342 const GLenum INCR_WRAP = 0x8507; 343 const GLenum DECR_WRAP = 0x8508; 344 345 /* StringName */ 346 const GLenum VENDOR = 0x1F00; 347 const GLenum RENDERER = 0x1F01; 348 const GLenum VERSION = 0x1F02; 349 350 /* TextureMagFilter */ 351 const GLenum NEAREST = 0x2600; 352 const GLenum LINEAR = 0x2601; 353 354 /* TextureMinFilter */ 355 /* NEAREST */ 356 /* LINEAR */ 357 const GLenum NEAREST_MIPMAP_NEAREST = 0x2700; 358 const GLenum LINEAR_MIPMAP_NEAREST = 0x2701; 359 const GLenum NEAREST_MIPMAP_LINEAR = 0x2702; 360 const GLenum LINEAR_MIPMAP_LINEAR = 0x2703; 361 362 /* TextureParameterName */ 363 const GLenum TEXTURE_MAG_FILTER = 0x2800; 364 const GLenum TEXTURE_MIN_FILTER = 0x2801; 365 const GLenum TEXTURE_WRAP_S = 0x2802; 366 const GLenum TEXTURE_WRAP_T = 0x2803; 367 368 /* TextureTarget */ 369 const GLenum TEXTURE_2D = 0x0DE1; 370 const GLenum TEXTURE = 0x1702; 371 372 const GLenum TEXTURE_CUBE_MAP = 0x8513; 373 const GLenum TEXTURE_BINDING_CUBE_MAP = 0x8514; 374 const GLenum TEXTURE_CUBE_MAP_POSITIVE_X = 0x8515; 375 const GLenum TEXTURE_CUBE_MAP_NEGATIVE_X = 0x8516; 376 const GLenum TEXTURE_CUBE_MAP_POSITIVE_Y = 0x8517; 377 const GLenum TEXTURE_CUBE_MAP_NEGATIVE_Y = 0x8518; 378 const GLenum TEXTURE_CUBE_MAP_POSITIVE_Z = 0x8519; 379 const GLenum TEXTURE_CUBE_MAP_NEGATIVE_Z = 0x851A; 380 const GLenum MAX_CUBE_MAP_TEXTURE_SIZE = 0x851C; 381 382 /* TextureUnit */ 383 const GLenum TEXTURE0 = 0x84C0; 384 const GLenum TEXTURE1 = 0x84C1; 385 const GLenum TEXTURE2 = 0x84C2; 386 const GLenum TEXTURE3 = 0x84C3; 387 const GLenum TEXTURE4 = 0x84C4; 388 const GLenum TEXTURE5 = 0x84C5; 389 const GLenum TEXTURE6 = 0x84C6; 390 const GLenum TEXTURE7 = 0x84C7; 391 const GLenum TEXTURE8 = 0x84C8; 392 const GLenum TEXTURE9 = 0x84C9; 393 const GLenum TEXTURE10 = 0x84CA; 394 const GLenum TEXTURE11 = 0x84CB; 395 const GLenum TEXTURE12 = 0x84CC; 396 const GLenum TEXTURE13 = 0x84CD; 397 const GLenum TEXTURE14 = 0x84CE; 398 const GLenum TEXTURE15 = 0x84CF; 399 const GLenum TEXTURE16 = 0x84D0; 400 const GLenum TEXTURE17 = 0x84D1; 401 const GLenum TEXTURE18 = 0x84D2; 402 const GLenum TEXTURE19 = 0x84D3; 403 const GLenum TEXTURE20 = 0x84D4; 404 const GLenum TEXTURE21 = 0x84D5; 405 const GLenum TEXTURE22 = 0x84D6; 406 const GLenum TEXTURE23 = 0x84D7; 407 const GLenum TEXTURE24 = 0x84D8; 408 const GLenum TEXTURE25 = 0x84D9; 409 const GLenum TEXTURE26 = 0x84DA; 410 const GLenum TEXTURE27 = 0x84DB; 411 const GLenum TEXTURE28 = 0x84DC; 412 const GLenum TEXTURE29 = 0x84DD; 413 const GLenum TEXTURE30 = 0x84DE; 414 const GLenum TEXTURE31 = 0x84DF; 415 const GLenum ACTIVE_TEXTURE = 0x84E0; 416 417 /* TextureWrapMode */ 418 const GLenum REPEAT = 0x2901; 419 const GLenum CLAMP_TO_EDGE = 0x812F; 420 const GLenum MIRRORED_REPEAT = 0x8370; 421 422 /* Uniform Types */ 423 const GLenum FLOAT_VEC2 = 0x8B50; 424 const GLenum FLOAT_VEC3 = 0x8B51; 425 const GLenum FLOAT_VEC4 = 0x8B52; 426 const GLenum INT_VEC2 = 0x8B53; 427 const GLenum INT_VEC3 = 0x8B54; 428 const GLenum INT_VEC4 = 0x8B55; 429 const GLenum BOOL = 0x8B56; 430 const GLenum BOOL_VEC2 = 0x8B57; 431 const GLenum BOOL_VEC3 = 0x8B58; 432 const GLenum BOOL_VEC4 = 0x8B59; 433 const GLenum FLOAT_MAT2 = 0x8B5A; 434 const GLenum FLOAT_MAT3 = 0x8B5B; 435 const GLenum FLOAT_MAT4 = 0x8B5C; 436 const GLenum SAMPLER_2D = 0x8B5E; 437 const GLenum SAMPLER_CUBE = 0x8B60; 438 439 /* Vertex Arrays */ 440 const GLenum VERTEX_ATTRIB_ARRAY_ENABLED = 0x8622; 441 const GLenum VERTEX_ATTRIB_ARRAY_SIZE = 0x8623; 442 const GLenum VERTEX_ATTRIB_ARRAY_STRIDE = 0x8624; 443 const GLenum VERTEX_ATTRIB_ARRAY_TYPE = 0x8625; 444 const GLenum VERTEX_ATTRIB_ARRAY_NORMALIZED = 0x886A; 445 const GLenum VERTEX_ATTRIB_ARRAY_POINTER = 0x8645; 446 const GLenum VERTEX_ATTRIB_ARRAY_BUFFER_BINDING = 0x889F; 447 448 /* Read Format */ 449 const GLenum IMPLEMENTATION_COLOR_READ_TYPE = 0x8B9A; 450 const GLenum IMPLEMENTATION_COLOR_READ_FORMAT = 0x8B9B; 451 452 /* Shader Source */ 453 const GLenum COMPILE_STATUS = 0x8B81; 454 455 /* Shader Precision-Specified Types */ 456 const GLenum LOW_FLOAT = 0x8DF0; 457 const GLenum MEDIUM_FLOAT = 0x8DF1; 458 const GLenum HIGH_FLOAT = 0x8DF2; 459 const GLenum LOW_INT = 0x8DF3; 460 const GLenum MEDIUM_INT = 0x8DF4; 461 const GLenum HIGH_INT = 0x8DF5; 462 463 /* Framebuffer Object. */ 464 const GLenum FRAMEBUFFER = 0x8D40; 465 const GLenum RENDERBUFFER = 0x8D41; 466 467 const GLenum RGBA4 = 0x8056; 468 const GLenum RGB5_A1 = 0x8057; 469 const GLenum RGB565 = 0x8D62; 470 const GLenum DEPTH_COMPONENT16 = 0x81A5; 471 const GLenum STENCIL_INDEX8 = 0x8D48; 472 const GLenum DEPTH_STENCIL = 0x84F9; 473 474 const GLenum RENDERBUFFER_WIDTH = 0x8D42; 475 const GLenum RENDERBUFFER_HEIGHT = 0x8D43; 476 const GLenum RENDERBUFFER_INTERNAL_FORMAT = 0x8D44; 477 const GLenum RENDERBUFFER_RED_SIZE = 0x8D50; 478 const GLenum RENDERBUFFER_GREEN_SIZE = 0x8D51; 479 const GLenum RENDERBUFFER_BLUE_SIZE = 0x8D52; 480 const GLenum RENDERBUFFER_ALPHA_SIZE = 0x8D53; 481 const GLenum RENDERBUFFER_DEPTH_SIZE = 0x8D54; 482 const GLenum RENDERBUFFER_STENCIL_SIZE = 0x8D55; 483 484 const GLenum FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE = 0x8CD0; 485 const GLenum FRAMEBUFFER_ATTACHMENT_OBJECT_NAME = 0x8CD1; 486 const GLenum FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL = 0x8CD2; 487 const GLenum FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE = 0x8CD3; 488 489 const GLenum COLOR_ATTACHMENT0 = 0x8CE0; 490 const GLenum DEPTH_ATTACHMENT = 0x8D00; 491 const GLenum STENCIL_ATTACHMENT = 0x8D20; 492 const GLenum DEPTH_STENCIL_ATTACHMENT = 0x821A; 493 494 const GLenum NONE = 0; 495 496 const GLenum FRAMEBUFFER_COMPLETE = 0x8CD5; 497 const GLenum FRAMEBUFFER_INCOMPLETE_ATTACHMENT = 0x8CD6; 498 const GLenum FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT = 0x8CD7; 499 const GLenum FRAMEBUFFER_INCOMPLETE_DIMENSIONS = 0x8CD9; 500 const GLenum FRAMEBUFFER_UNSUPPORTED = 0x8CDD; 501 502 const GLenum FRAMEBUFFER_BINDING = 0x8CA6; 503 const GLenum RENDERBUFFER_BINDING = 0x8CA7; 504 const GLenum MAX_RENDERBUFFER_SIZE = 0x84E8; 505 506 const GLenum INVALID_FRAMEBUFFER_OPERATION = 0x0506; 507 508 /* WebGL-specific enums */ 509 const GLenum UNPACK_FLIP_Y_WEBGL = 0x9240; 510 const GLenum UNPACK_PREMULTIPLY_ALPHA_WEBGL = 0x9241; 511 const GLenum CONTEXT_LOST_WEBGL = 0x9242; 512 const GLenum UNPACK_COLORSPACE_CONVERSION_WEBGL = 0x9243; 513 const GLenum BROWSER_DEFAULT_WEBGL = 0x9244; 514 515 [Exposed=Window] readonly attribute (HTMLCanvasElement or OffscreenCanvas) canvas; 516 [Exposed=Worker] readonly attribute OffscreenCanvas canvas; 517 readonly attribute GLsizei drawingBufferWidth; 518 readonly attribute GLsizei drawingBufferHeight; 519 520 [WebGLHandlesContextLoss] WebGLContextAttributes? getContextAttributes(); 521 [WebGLHandlesContextLoss] boolean isContextLost(); 522 523 sequence<DOMString>? getSupportedExtensions(); 524 object? getExtension(DOMString name); 525 526 undefined activeTexture(GLenum texture); 527 undefined attachShader(WebGLProgram program, WebGLShader shader); 528 undefined bindAttribLocation(WebGLProgram program, GLuint index, DOMString name); 529 undefined bindBuffer(GLenum target, WebGLBuffer? buffer); 530 undefined bindFramebuffer(GLenum target, WebGLFramebuffer? framebuffer); 531 undefined bindRenderbuffer(GLenum target, WebGLRenderbuffer? renderbuffer); 532 undefined bindTexture(GLenum target, WebGLTexture? texture); 533 undefined blendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); 534 undefined blendEquation(GLenum mode); 535 undefined blendEquationSeparate(GLenum modeRGB, GLenum modeAlpha); 536 undefined blendFunc(GLenum sfactor, GLenum dfactor); 537 undefined blendFuncSeparate(GLenum srcRGB, GLenum dstRGB, 538 GLenum srcAlpha, GLenum dstAlpha); 539 540 [WebGLHandlesContextLoss] GLenum checkFramebufferStatus(GLenum target); 541 undefined clear(GLbitfield mask); 542 undefined clearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); 543 undefined clearDepth(GLclampf depth); 544 undefined clearStencil(GLint s); 545 undefined colorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); 546 undefined compileShader(WebGLShader shader); 547 548 undefined copyTexImage2D(GLenum target, GLint level, GLenum internalformat, 549 GLint x, GLint y, GLsizei width, GLsizei height, 550 GLint border); 551 undefined copyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, 552 GLint x, GLint y, GLsizei width, GLsizei height); 553 554 WebGLBuffer? createBuffer(); 555 WebGLFramebuffer? createFramebuffer(); 556 WebGLProgram? createProgram(); 557 WebGLRenderbuffer? createRenderbuffer(); 558 WebGLShader? createShader(GLenum type); 559 WebGLTexture? createTexture(); 560 561 undefined cullFace(GLenum mode); 562 563 undefined deleteBuffer(WebGLBuffer? buffer); 564 undefined deleteFramebuffer(WebGLFramebuffer? framebuffer); 565 undefined deleteProgram(WebGLProgram? program); 566 undefined deleteRenderbuffer(WebGLRenderbuffer? renderbuffer); 567 undefined deleteShader(WebGLShader? shader); 568 undefined deleteTexture(WebGLTexture? texture); 569 570 undefined depthFunc(GLenum func); 571 undefined depthMask(GLboolean flag); 572 undefined depthRange(GLclampf zNear, GLclampf zFar); 573 undefined detachShader(WebGLProgram program, WebGLShader shader); 574 undefined disable(GLenum cap); 575 undefined disableVertexAttribArray(GLuint index); 576 undefined drawArrays(GLenum mode, GLint first, GLsizei count); 577 undefined drawElements(GLenum mode, GLsizei count, GLenum type, GLintptr offset); 578 579 undefined enable(GLenum cap); 580 undefined enableVertexAttribArray(GLuint index); 581 undefined finish(); 582 undefined flush(); 583 undefined framebufferRenderbuffer(GLenum target, GLenum attachment, 584 GLenum renderbuffertarget, 585 WebGLRenderbuffer? renderbuffer); 586 undefined framebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, 587 WebGLTexture? texture, GLint level); 588 undefined frontFace(GLenum mode); 589 590 undefined generateMipmap(GLenum target); 591 592 WebGLActiveInfo? getActiveAttrib(WebGLProgram program, GLuint index); 593 WebGLActiveInfo? getActiveUniform(WebGLProgram program, GLuint index); 594 sequence<WebGLShader>? getAttachedShaders(WebGLProgram program); 595 596 [WebGLHandlesContextLoss] GLint getAttribLocation(WebGLProgram program, DOMString name); 597 598 any getBufferParameter(GLenum target, GLenum pname); 599 any getParameter(GLenum pname); 600 601 [WebGLHandlesContextLoss] GLenum getError(); 602 603 any getFramebufferAttachmentParameter(GLenum target, GLenum attachment, 604 GLenum pname); 605 any getProgramParameter(WebGLProgram program, GLenum pname); 606 DOMString? getProgramInfoLog(WebGLProgram program); 607 any getRenderbufferParameter(GLenum target, GLenum pname); 608 any getShaderParameter(WebGLShader shader, GLenum pname); 609 WebGLShaderPrecisionFormat? getShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype); 610 DOMString? getShaderInfoLog(WebGLShader shader); 611 612 DOMString? getShaderSource(WebGLShader shader); 613 614 any getTexParameter(GLenum target, GLenum pname); 615 616 any getUniform(WebGLProgram program, WebGLUniformLocation location); 617 618 WebGLUniformLocation? getUniformLocation(WebGLProgram program, DOMString name); 619 620 any getVertexAttrib(GLuint index, GLenum pname); 621 622 [WebGLHandlesContextLoss] GLintptr getVertexAttribOffset(GLuint index, GLenum pname); 623 624 undefined hint(GLenum target, GLenum mode); 625 [WebGLHandlesContextLoss] GLboolean isBuffer(WebGLBuffer? buffer); 626 [WebGLHandlesContextLoss] GLboolean isEnabled(GLenum cap); 627 [WebGLHandlesContextLoss] GLboolean isFramebuffer(WebGLFramebuffer? framebuffer); 628 [WebGLHandlesContextLoss] GLboolean isProgram(WebGLProgram? program); 629 [WebGLHandlesContextLoss] GLboolean isRenderbuffer(WebGLRenderbuffer? renderbuffer); 630 [WebGLHandlesContextLoss] GLboolean isShader(WebGLShader? shader); 631 [WebGLHandlesContextLoss] GLboolean isTexture(WebGLTexture? texture); 632 undefined lineWidth(GLfloat width); 633 undefined linkProgram(WebGLProgram program); 634 undefined pixelStorei(GLenum pname, GLint param); 635 undefined polygonOffset(GLfloat factor, GLfloat units); 636 637 undefined renderbufferStorage(GLenum target, GLenum internalformat, 638 GLsizei width, GLsizei height); 639 undefined sampleCoverage(GLclampf value, GLboolean invert); 640 undefined scissor(GLint x, GLint y, GLsizei width, GLsizei height); 641 642 undefined shaderSource(WebGLShader shader, DOMString source); 643 644 undefined stencilFunc(GLenum func, GLint ref, GLuint mask); 645 undefined stencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask); 646 undefined stencilMask(GLuint mask); 647 undefined stencilMaskSeparate(GLenum face, GLuint mask); 648 undefined stencilOp(GLenum fail, GLenum zfail, GLenum zpass); 649 undefined stencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass); 650 651 undefined texParameterf(GLenum target, GLenum pname, GLfloat param); 652 undefined texParameteri(GLenum target, GLenum pname, GLint param); 653 654 undefined uniform1f(WebGLUniformLocation? location, GLfloat x); 655 undefined uniform2f(WebGLUniformLocation? location, GLfloat x, GLfloat y); 656 undefined uniform3f(WebGLUniformLocation? location, GLfloat x, GLfloat y, GLfloat z); 657 undefined uniform4f(WebGLUniformLocation? location, GLfloat x, GLfloat y, GLfloat z, GLfloat w); 658 659 undefined uniform1i(WebGLUniformLocation? location, GLint x); 660 undefined uniform2i(WebGLUniformLocation? location, GLint x, GLint y); 661 undefined uniform3i(WebGLUniformLocation? location, GLint x, GLint y, GLint z); 662 undefined uniform4i(WebGLUniformLocation? location, GLint x, GLint y, GLint z, GLint w); 663 664 undefined useProgram(WebGLProgram? program); 665 undefined validateProgram(WebGLProgram program); 666 667 undefined vertexAttrib1f(GLuint index, GLfloat x); 668 undefined vertexAttrib2f(GLuint index, GLfloat x, GLfloat y); 669 undefined vertexAttrib3f(GLuint index, GLfloat x, GLfloat y, GLfloat z); 670 undefined vertexAttrib4f(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); 671 672 undefined vertexAttrib1fv(GLuint index, Float32List values); 673 undefined vertexAttrib2fv(GLuint index, Float32List values); 674 undefined vertexAttrib3fv(GLuint index, Float32List values); 675 undefined vertexAttrib4fv(GLuint index, Float32List values); 676 677 undefined vertexAttribPointer(GLuint index, GLint size, GLenum type, 678 GLboolean normalized, GLsizei stride, GLintptr offset); 679 680 undefined viewport(GLint x, GLint y, GLsizei width, GLsizei height); 681}; 682 683interface mixin WebGLRenderingContextOverloads 684{ 685 undefined bufferData(GLenum target, GLsizeiptr size, GLenum usage); 686 undefined bufferData(GLenum target, [AllowShared] BufferSource? data, GLenum usage); 687 undefined bufferSubData(GLenum target, GLintptr offset, [AllowShared] BufferSource data); 688 689 undefined compressedTexImage2D(GLenum target, GLint level, GLenum internalformat, 690 GLsizei width, GLsizei height, GLint border, 691 [AllowShared] ArrayBufferView data); 692 undefined compressedTexSubImage2D(GLenum target, GLint level, 693 GLint xoffset, GLint yoffset, 694 GLsizei width, GLsizei height, GLenum format, 695 [AllowShared] ArrayBufferView data); 696 697 undefined readPixels(GLint x, GLint y, GLsizei width, GLsizei height, 698 GLenum format, GLenum type, [AllowShared] ArrayBufferView? pixels); 699 700 undefined texImage2D(GLenum target, GLint level, GLint internalformat, 701 GLsizei width, GLsizei height, GLint border, GLenum format, 702 GLenum type, [AllowShared] ArrayBufferView? pixels); 703 undefined texImage2D(GLenum target, GLint level, GLint internalformat, 704 GLenum format, GLenum type, TexImageSource source); // May throw DOMException 705 706 undefined texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, 707 GLsizei width, GLsizei height, 708 GLenum format, GLenum type, [AllowShared] ArrayBufferView? pixels); 709 undefined texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, 710 GLenum format, GLenum type, TexImageSource source); // May throw DOMException 711 712 undefined uniform1fv(WebGLUniformLocation? location, Float32List v); 713 undefined uniform2fv(WebGLUniformLocation? location, Float32List v); 714 undefined uniform3fv(WebGLUniformLocation? location, Float32List v); 715 undefined uniform4fv(WebGLUniformLocation? location, Float32List v); 716 717 undefined uniform1iv(WebGLUniformLocation? location, Int32List v); 718 undefined uniform2iv(WebGLUniformLocation? location, Int32List v); 719 undefined uniform3iv(WebGLUniformLocation? location, Int32List v); 720 undefined uniform4iv(WebGLUniformLocation? location, Int32List v); 721 722 undefined uniformMatrix2fv(WebGLUniformLocation? location, GLboolean transpose, Float32List value); 723 undefined uniformMatrix3fv(WebGLUniformLocation? location, GLboolean transpose, Float32List value); 724 undefined uniformMatrix4fv(WebGLUniformLocation? location, GLboolean transpose, Float32List value); 725}; 726 727[Exposed=(Window,Worker)] 728interface WebGLRenderingContext 729{ 730}; 731WebGLRenderingContext includes WebGLRenderingContextBase; 732WebGLRenderingContext includes WebGLRenderingContextOverloads; 733 734[Exposed=(Window,Worker)] 735interface WebGLContextEvent : Event { 736 constructor(DOMString type, optional WebGLContextEventInit eventInit = {}); 737 readonly attribute DOMString statusMessage; 738}; 739 740// EventInit is defined in the DOM4 specification. 741dictionary WebGLContextEventInit : EventInit { 742 DOMString statusMessage = ""; 743}; 744