├── .gitignore ├── .gitmodules ├── LICENSE ├── README.md ├── examples ├── babylon.js ├── test.ts └── three.js ├── mod.ts ├── src ├── core │ ├── README.md │ ├── const.ts │ ├── glfw.ts │ ├── mod.ts │ ├── opengl.ts │ └── util.ts └── web │ ├── README.md │ ├── animation.ts │ ├── canvas.ts │ ├── context.ts │ ├── document.ts │ ├── element.ts │ ├── ext │ ├── angle_instance_arrays.ts │ ├── ext_blend_minmax.ts │ ├── ext_color_buffer_float.ts │ ├── ext_color_buffer_half_float.ts │ ├── ext_disjoint_timer_query.ts │ ├── ext_float_blend.ts │ ├── ext_frag_depth.ts │ ├── ext_shader_texture_lod.ts │ ├── ext_srgb.ts │ ├── ext_texture_filter_anisotropic.ts │ ├── khr_parallel_shader_compile.ts │ ├── mod.ts │ ├── oes_texture_float_linear.ts │ └── oes_texture_half_float.ts │ ├── image.ts │ ├── mod.ts │ └── webgl_object.ts └── tools └── cts_runner.ts /.gitignore: -------------------------------------------------------------------------------- 1 | # my testing scripts 2 | *.bat 3 | # dlls etc 4 | dist/ 5 | *.dll 6 | # vscode config 7 | .vscode/ 8 | # temp testing 9 | three 10 | # temp test data for debugging 11 | tools/test 12 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "WebGL"] 2 | path = WebGL 3 | url = https://github.com/KhronosGroup/WebGL 4 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | 2 | Apache License 3 | Version 2.0, January 2004 4 | http://www.apache.org/licenses/ 5 | 6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 7 | 8 | 1. Definitions. 9 | 10 | "License" shall mean the terms and conditions for use, reproduction, 11 | and distribution as defined by Sections 1 through 9 of this document. 12 | 13 | "Licensor" shall mean the copyright owner or entity authorized by 14 | the copyright owner that is granting the License. 15 | 16 | "Legal Entity" shall mean the union of the acting entity and all 17 | other entities that control, are controlled by, or are under common 18 | control with that entity. For the purposes of this definition, 19 | "control" means (i) the power, direct or indirect, to cause the 20 | direction or management of such entity, whether by contract or 21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 22 | outstanding shares, or (iii) beneficial ownership of such entity. 23 | 24 | "You" (or "Your") shall mean an individual or Legal Entity 25 | exercising permissions granted by this License. 26 | 27 | "Source" form shall mean the preferred form for making modifications, 28 | including but not limited to software source code, documentation 29 | source, and configuration files. 30 | 31 | "Object" form shall mean any form resulting from mechanical 32 | transformation or translation of a Source form, including but 33 | not limited to compiled object code, generated documentation, 34 | and conversions to other media types. 35 | 36 | "Work" shall mean the work of authorship, whether in Source or 37 | Object form, made available under the License, as indicated by a 38 | copyright notice that is included in or attached to the work 39 | (an example is provided in the Appendix below). 40 | 41 | "Derivative Works" shall mean any work, whether in Source or Object 42 | form, that is based on (or derived from) the Work and for which the 43 | editorial revisions, annotations, elaborations, or other modifications 44 | represent, as a whole, an original work of authorship. For the purposes 45 | of this License, Derivative Works shall not include works that remain 46 | separable from, or merely link (or bind by name) to the interfaces of, 47 | the Work and Derivative Works thereof. 48 | 49 | "Contribution" shall mean any work of authorship, including 50 | the original version of the Work and any modifications or additions 51 | to that Work or Derivative Works thereof, that is intentionally 52 | submitted to Licensor for inclusion in the Work by the copyright owner 53 | or by an individual or Legal Entity authorized to submit on behalf of 54 | the copyright owner. For the purposes of this definition, "submitted" 55 | means any form of electronic, verbal, or written communication sent 56 | to the Licensor or its representatives, including but not limited to 57 | communication on electronic mailing lists, source code control systems, 58 | and issue tracking systems that are managed by, or on behalf of, the 59 | Licensor for the purpose of discussing and improving the Work, but 60 | excluding communication that is conspicuously marked or otherwise 61 | designated in writing by the copyright owner as "Not a Contribution." 62 | 63 | "Contributor" shall mean Licensor and any individual or Legal Entity 64 | on behalf of whom a Contribution has been received by Licensor and 65 | subsequently incorporated within the Work. 66 | 67 | 2. Grant of Copyright License. Subject to the terms and conditions of 68 | this License, each Contributor hereby grants to You a perpetual, 69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 70 | copyright license to reproduce, prepare Derivative Works of, 71 | publicly display, publicly perform, sublicense, and distribute the 72 | Work and such Derivative Works in Source or Object form. 73 | 74 | 3. Grant of Patent License. Subject to the terms and conditions of 75 | this License, each Contributor hereby grants to You a perpetual, 76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 77 | (except as stated in this section) patent license to make, have made, 78 | use, offer to sell, sell, import, and otherwise transfer the Work, 79 | where such license applies only to those patent claims licensable 80 | by such Contributor that are necessarily infringed by their 81 | Contribution(s) alone or by combination of their Contribution(s) 82 | with the Work to which such Contribution(s) was submitted. If You 83 | institute patent litigation against any entity (including a 84 | cross-claim or counterclaim in a lawsuit) alleging that the Work 85 | or a Contribution incorporated within the Work constitutes direct 86 | or contributory patent infringement, then any patent licenses 87 | granted to You under this License for that Work shall terminate 88 | as of the date such litigation is filed. 89 | 90 | 4. Redistribution. You may reproduce and distribute copies of the 91 | Work or Derivative Works thereof in any medium, with or without 92 | modifications, and in Source or Object form, provided that You 93 | meet the following conditions: 94 | 95 | (a) You must give any other recipients of the Work or 96 | Derivative Works a copy of this License; and 97 | 98 | (b) You must cause any modified files to carry prominent notices 99 | stating that You changed the files; and 100 | 101 | (c) You must retain, in the Source form of any Derivative Works 102 | that You distribute, all copyright, patent, trademark, and 103 | attribution notices from the Source form of the Work, 104 | excluding those notices that do not pertain to any part of 105 | the Derivative Works; and 106 | 107 | (d) If the Work includes a "NOTICE" text file as part of its 108 | distribution, then any Derivative Works that You distribute must 109 | include a readable copy of the attribution notices contained 110 | within such NOTICE file, excluding those notices that do not 111 | pertain to any part of the Derivative Works, in at least one 112 | of the following places: within a NOTICE text file distributed 113 | as part of the Derivative Works; within the Source form or 114 | documentation, if provided along with the Derivative Works; or, 115 | within a display generated by the Derivative Works, if and 116 | wherever such third-party notices normally appear. The contents 117 | of the NOTICE file are for informational purposes only and 118 | do not modify the License. You may add Your own attribution 119 | notices within Derivative Works that You distribute, alongside 120 | or as an addendum to the NOTICE text from the Work, provided 121 | that such additional attribution notices cannot be construed 122 | as modifying the License. 123 | 124 | You may add Your own copyright statement to Your modifications and 125 | may provide additional or different license terms and conditions 126 | for use, reproduction, or distribution of Your modifications, or 127 | for any such Derivative Works as a whole, provided Your use, 128 | reproduction, and distribution of the Work otherwise complies with 129 | the conditions stated in this License. 130 | 131 | 5. Submission of Contributions. Unless You explicitly state otherwise, 132 | any Contribution intentionally submitted for inclusion in the Work 133 | by You to the Licensor shall be under the terms and conditions of 134 | this License, without any additional terms or conditions. 135 | Notwithstanding the above, nothing herein shall supersede or modify 136 | the terms of any separate license agreement you may have executed 137 | with Licensor regarding such Contributions. 138 | 139 | 6. Trademarks. This License does not grant permission to use the trade 140 | names, trademarks, service marks, or product names of the Licensor, 141 | except as required for reasonable and customary use in describing the 142 | origin of the Work and reproducing the content of the NOTICE file. 143 | 144 | 7. Disclaimer of Warranty. Unless required by applicable law or 145 | agreed to in writing, Licensor provides the Work (and each 146 | Contributor provides its Contributions) on an "AS IS" BASIS, 147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 148 | implied, including, without limitation, any warranties or conditions 149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 150 | PARTICULAR PURPOSE. You are solely responsible for determining the 151 | appropriateness of using or redistributing the Work and assume any 152 | risks associated with Your exercise of permissions under this License. 153 | 154 | 8. Limitation of Liability. In no event and under no legal theory, 155 | whether in tort (including negligence), contract, or otherwise, 156 | unless required by applicable law (such as deliberate and grossly 157 | negligent acts) or agreed to in writing, shall any Contributor be 158 | liable to You for damages, including any direct, indirect, special, 159 | incidental, or consequential damages of any character arising as a 160 | result of this License or out of the use or inability to use the 161 | Work (including but not limited to damages for loss of goodwill, 162 | work stoppage, computer failure or malfunction, or any and all 163 | other commercial damages or losses), even if such Contributor 164 | has been advised of the possibility of such damages. 165 | 166 | 9. Accepting Warranty or Additional Liability. While redistributing 167 | the Work or Derivative Works thereof, You may choose to offer, 168 | and charge a fee for, acceptance of support, warranty, indemnity, 169 | or other liability obligations and/or rights consistent with this 170 | License. However, in accepting such obligations, You may act only 171 | on Your own behalf and on Your sole responsibility, not on behalf 172 | of any other Contributor, and only if You agree to indemnify, 173 | defend, and hold each Contributor harmless for any liability 174 | incurred by, or claims asserted against, such Contributor by reason 175 | of your accepting any such warranty or additional liability. 176 | 177 | END OF TERMS AND CONDITIONS 178 | 179 | APPENDIX: How to apply the Apache License to your work. 180 | 181 | To apply the Apache License to your work, attach the following 182 | boilerplate notice, with the fields enclosed by brackets "[]" 183 | replaced with your own identifying information. (Don't include 184 | the brackets!) The text should be enclosed in the appropriate 185 | comment syntax for the file format. We also recommend that a 186 | file or class name and description of purpose be included on the 187 | same "printed page" as the copyright notice for easier 188 | identification within third-party archives. 189 | 190 | Copyright 2021 DjDeveloperr 191 | 192 | Licensed under the Apache License, Version 2.0 (the "License"); 193 | you may not use this file except in compliance with the License. 194 | You may obtain a copy of the License at 195 | 196 | http://www.apache.org/licenses/LICENSE-2.0 197 | 198 | Unless required by applicable law or agreed to in writing, software 199 | distributed under the License is distributed on an "AS IS" BASIS, 200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 201 | See the License for the specific language governing permissions and 202 | limitations under the License. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # deno_gl 2 | 3 | WebGL API implementation for Deno, built on GLFW using FFI. 4 | 5 | Currently does not support macOS because of the lack of native 6 | OpenGL ES support. Feel free to contribute the support if you 7 | can. Using something like [angle](https://github.com/google/angle) 8 | is preferred. 9 | 10 | ## TODO 11 | 12 | There are couple of bugs to fix yet. Most of them are unknown, which simply 13 | cause libraries like Tensorflow.js WebGL backend to return values zeroed out. 14 | 15 | ## Usage 16 | 17 | 1. Make `dist` directory if it doesn't exist. 18 | 2. Download GLFW from [its website](https://www.glfw.org/) and place 19 | `[lib]glfw3.[so|dll|dylib]` in `dist`. 20 | 21 | ## License 22 | 23 | Apache-2.0. Check [LICENSE](LICENSE) for more info. 24 | 25 | Copyright 2022 © DjDeveloperr 26 | -------------------------------------------------------------------------------- /examples/babylon.js: -------------------------------------------------------------------------------- 1 | import { Canvas } from "../mod.ts"; 2 | import "https://cdn.babylonjs.com/babylon.max.js"; 3 | import "https://deno.land/x/xhr@0.1.0/mod.ts"; 4 | 5 | const canvas = new Canvas({ 6 | title: "Babylon.js", 7 | width: 800, 8 | height: 600, 9 | }); 10 | 11 | const engine = new BABYLON.Engine(canvas, true, { 12 | preserveDrawingBuffer: true, 13 | stencil: true, 14 | }); 15 | 16 | function createScene() { 17 | const scene = new BABYLON.Scene(engine); 18 | 19 | const camera = new BABYLON.ArcRotateCamera( 20 | "camera", 21 | -Math.PI / 2, 22 | Math.PI / 2.5, 23 | 15, 24 | new BABYLON.Vector3(0, 0, 0), 25 | ); 26 | camera.attachControl(canvas, true); 27 | const light = new BABYLON.HemisphericLight( 28 | "light", 29 | new BABYLON.Vector3(1, 1, 0), 30 | ); 31 | 32 | BABYLON.SceneLoader.ImportMeshAsync( 33 | ["ground", "semi_house"], 34 | "https://assets.babylonjs.com/meshes/", 35 | "both_houses_scene.babylon", 36 | ); 37 | 38 | return scene; 39 | } 40 | 41 | const scene = createScene(); 42 | 43 | engine.runRenderLoop(function () { 44 | if (canvas.shouldClose()) { 45 | engine.stopRenderLoop(); 46 | return; 47 | } 48 | 49 | canvas.updateEvents(); 50 | scene.render(); 51 | canvas.swapBuffers(); 52 | }); 53 | -------------------------------------------------------------------------------- /examples/test.ts: -------------------------------------------------------------------------------- 1 | import { cstr, gl, glfw, initGL } from "../mod.ts"; 2 | import { 3 | Matrix4, 4 | PerspectiveFov, 5 | Rad, 6 | Vector3, 7 | } from "https://deno.land/x/gmath@0.1.11/mod.ts"; 8 | 9 | if (!glfw.init()) { 10 | throw new Error("Failed to initialize GLFW"); 11 | } 12 | 13 | if (Deno.build.os === "darwin") { 14 | // For using ANGLE 15 | glfw.windowHint(glfw.CONTEXT_CREATION_API, glfw.EGL_CONTEXT_API); 16 | } 17 | 18 | glfw.windowHint(glfw.SAMPLES, 4); 19 | glfw.windowHint(glfw.CLIENT_API, glfw.OPENGL_ES_API); 20 | glfw.windowHint(glfw.CONTEXT_VERSION_MAJOR, 3); 21 | glfw.windowHint(glfw.CONTEXT_VERSION_MINOR, 0); 22 | glfw.windowHint(glfw.OPENGL_FORWARD_COMPAT, glfw.OPENGL_CORE_PROFILE); 23 | 24 | const width = 600, height = 500; 25 | 26 | const win = glfw.createWindow( 27 | width, 28 | height, 29 | cstr("Hello World"), 30 | null, 31 | null, 32 | ) as Deno.UnsafePointer; 33 | 34 | if (win.value === 0n) { 35 | glfw.terminate(); 36 | throw new Error("Failed to create GLFW window"); 37 | } 38 | 39 | glfw.makeContextCurrent(win); 40 | initGL(); 41 | glfw.setInputMode(win, glfw.STICKY_KEYS, gl.TRUE); 42 | 43 | gl.enable(gl.DEBUG_OUTPUT); 44 | // gl.debugMessageCallback(); 45 | 46 | gl.enable(gl.DEPTH_TEST); 47 | gl.depthFunc(gl.LESS); 48 | 49 | function loadShaders(vertex: string, fragment: string) { 50 | const vertexShaderID = gl.createShader(gl.VERTEX_SHADER); 51 | const fragmentShaderID = gl.createShader(gl.FRAGMENT_SHADER); 52 | 53 | const result = new Uint32Array(1); 54 | const infoLogLength = new Uint32Array(1); 55 | 56 | const vertPtr = new BigUint64Array(1); 57 | vertPtr[0] = Deno.UnsafePointer.of(cstr(vertex)).value; 58 | 59 | gl.shaderSource(vertexShaderID, 1, vertPtr, null); 60 | 61 | gl.compileShader(vertexShaderID); 62 | gl.getShaderiv(vertexShaderID, gl.COMPILE_STATUS, result); 63 | gl.getShaderiv( 64 | vertexShaderID, 65 | gl.INFO_LOG_LENGTH, 66 | infoLogLength, 67 | ); 68 | if (infoLogLength[0] > 0) { 69 | const infoLog = new Uint8Array(infoLogLength[0] + 1); 70 | gl.getShaderInfoLog( 71 | vertexShaderID, 72 | infoLogLength[0], 73 | null, 74 | infoLog, 75 | ); 76 | console.log(new TextDecoder().decode(infoLog)); 77 | } 78 | 79 | const fragPtr = new BigUint64Array(1); 80 | fragPtr[0] = Deno.UnsafePointer.of(cstr(fragment)).value; 81 | gl.shaderSource(fragmentShaderID, 1, fragPtr, null); 82 | gl.compileShader(fragmentShaderID); 83 | gl.getShaderiv(vertexShaderID, gl.COMPILE_STATUS, result); 84 | gl.getShaderiv( 85 | vertexShaderID, 86 | gl.INFO_LOG_LENGTH, 87 | infoLogLength, 88 | ); 89 | if (infoLogLength[0] > 0) { 90 | const infoLog = new Uint8Array(infoLogLength[0] + 1); 91 | gl.getShaderInfoLog( 92 | vertexShaderID, 93 | infoLogLength[0], 94 | null, 95 | infoLog, 96 | ); 97 | console.error(new TextDecoder().decode(infoLog)); 98 | } 99 | 100 | const programID = gl.createProgram() as number; 101 | gl.attachShader(programID, vertexShaderID); 102 | gl.attachShader(programID, fragmentShaderID); 103 | gl.linkProgram(programID); 104 | gl.getProgramiv(programID, gl.LINK_STATUS, result); 105 | gl.getProgramiv( 106 | programID, 107 | gl.INFO_LOG_LENGTH, 108 | infoLogLength, 109 | ); 110 | if (infoLogLength[0] > 0) { 111 | const infoLog = new Uint8Array(infoLogLength[0] + 1); 112 | gl.getProgramInfoLog( 113 | programID, 114 | infoLogLength[0], 115 | null, 116 | infoLog, 117 | ); 118 | console.error(new TextDecoder().decode(infoLog)); 119 | } 120 | 121 | gl.detachShader(programID, vertexShaderID); 122 | gl.detachShader(programID, fragmentShaderID); 123 | gl.deleteShader(vertexShaderID); 124 | gl.deleteShader(fragmentShaderID); 125 | 126 | return programID; 127 | } 128 | 129 | gl.clearColor(0.1, 0.2, 0.3, 1.0); 130 | 131 | const vao = new Uint32Array(1); 132 | gl.genVertexArrays(1, vao); 133 | gl.bindVertexArray(vao[0]); 134 | 135 | const VERTEX = ` 136 | #version 330 core 137 | 138 | layout(location = 0) in vec3 vertexPosition_modelspace; 139 | layout(location = 1) in vec3 vertexColor; 140 | 141 | uniform mat4 mvp; 142 | 143 | out vec3 fragmentColor; 144 | 145 | void main() { 146 | gl_Position = mvp * vec4(vertexPosition_modelspace, 1); 147 | fragmentColor = vertexColor; 148 | } 149 | `; 150 | 151 | const FRAGMENT = ` 152 | #version 330 core 153 | 154 | in vec3 fragmentColor; 155 | out vec3 color; 156 | 157 | void main() { 158 | color = fragmentColor; 159 | } 160 | `; 161 | 162 | const programID = loadShaders(VERTEX, FRAGMENT); 163 | 164 | // deno-fmt-ignore 165 | const vertexBufferData = new Float32Array([ 166 | -1.0,-1.0,-1.0, 167 | -1.0,-1.0, 1.0, 168 | -1.0, 1.0, 1.0, 169 | 1.0, 1.0,-1.0, 170 | -1.0,-1.0,-1.0, 171 | -1.0, 1.0,-1.0, 172 | 1.0,-1.0, 1.0, 173 | -1.0,-1.0,-1.0, 174 | 1.0,-1.0,-1.0, 175 | 1.0, 1.0,-1.0, 176 | 1.0,-1.0,-1.0, 177 | -1.0,-1.0,-1.0, 178 | -1.0,-1.0,-1.0, 179 | -1.0, 1.0, 1.0, 180 | -1.0, 1.0,-1.0, 181 | 1.0,-1.0, 1.0, 182 | -1.0,-1.0, 1.0, 183 | -1.0,-1.0,-1.0, 184 | -1.0, 1.0, 1.0, 185 | -1.0,-1.0, 1.0, 186 | 1.0,-1.0, 1.0, 187 | 1.0, 1.0, 1.0, 188 | 1.0,-1.0,-1.0, 189 | 1.0, 1.0,-1.0, 190 | 1.0,-1.0,-1.0, 191 | 1.0, 1.0, 1.0, 192 | 1.0,-1.0, 1.0, 193 | 1.0, 1.0, 1.0, 194 | 1.0, 1.0,-1.0, 195 | -1.0, 1.0,-1.0, 196 | 1.0, 1.0, 1.0, 197 | -1.0, 1.0,-1.0, 198 | -1.0, 1.0, 1.0, 199 | 1.0, 1.0, 1.0, 200 | -1.0, 1.0, 1.0, 201 | 1.0,-1.0, 1.0, 202 | ]); 203 | 204 | const vertexBuffer = new Uint32Array(1); 205 | gl.genBuffers(1, vertexBuffer); 206 | gl.bindBuffer(gl.ARRAY_BUFFER, vertexBuffer[0]); 207 | gl.bufferData( 208 | gl.ARRAY_BUFFER, 209 | vertexBufferData.byteLength, 210 | vertexBufferData, 211 | gl.STATIC_DRAW, 212 | ); 213 | 214 | // deno-fmt-ignore 215 | const colorBufferData = new Float32Array([ 216 | 0.583, 0.771, 0.014, 217 | 0.609, 0.115, 0.436, 218 | 0.327, 0.483, 0.844, 219 | 0.822, 0.569, 0.201, 220 | 0.435, 0.602, 0.223, 221 | 0.310, 0.747, 0.185, 222 | 0.597, 0.770, 0.761, 223 | 0.559, 0.436, 0.730, 224 | 0.359, 0.583, 0.152, 225 | 0.483, 0.596, 0.789, 226 | 0.559, 0.861, 0.639, 227 | 0.195, 0.548, 0.859, 228 | 0.014, 0.184, 0.576, 229 | 0.771, 0.328, 0.970, 230 | 0.406, 0.615, 0.116, 231 | 0.676, 0.977, 0.133, 232 | 0.971, 0.572, 0.833, 233 | 0.140, 0.616, 0.489, 234 | 0.997, 0.513, 0.064, 235 | 0.945, 0.719, 0.592, 236 | 0.543, 0.021, 0.978, 237 | 0.279, 0.317, 0.505, 238 | 0.167, 0.620, 0.077, 239 | 0.347, 0.857, 0.137, 240 | 0.055, 0.953, 0.042, 241 | 0.714, 0.505, 0.345, 242 | 0.783, 0.290, 0.734, 243 | 0.722, 0.645, 0.174, 244 | 0.302, 0.455, 0.848, 245 | 0.225, 0.587, 0.040, 246 | 0.517, 0.713, 0.338, 247 | 0.053, 0.959, 0.120, 248 | 0.393, 0.621, 0.362, 249 | 0.673, 0.211, 0.457, 250 | 0.820, 0.883, 0.371, 251 | 0.982, 0.099, 0.879, 252 | ]); 253 | 254 | const colorBuffer = new Uint32Array(1); 255 | gl.genBuffers(1, colorBuffer); 256 | gl.bindBuffer(gl.ARRAY_BUFFER, colorBuffer[0]); 257 | gl.bufferData( 258 | gl.ARRAY_BUFFER, 259 | colorBufferData.byteLength, 260 | colorBufferData, 261 | gl.STATIC_DRAW, 262 | ); 263 | 264 | let mvp!: Matrix4; 265 | 266 | function makeProjMatrix() { 267 | const proj = new PerspectiveFov(new Rad(45.0), width / height, 0.1, 100.0) 268 | .toPerspective() 269 | .toMatrix4(); 270 | const view = Matrix4.lookAtRh( 271 | new Vector3(4, 4, 3), 272 | Vector3.zero(), // origin 273 | new Vector3(0, 1, 0), 274 | ); 275 | const model = Matrix4.identity(); 276 | mvp = proj.mul(view.mul(model)); 277 | } 278 | makeProjMatrix(); 279 | 280 | const matrixID = gl.getUniformLocation(programID, cstr("mvp")); 281 | 282 | const times = []; 283 | let fps; 284 | 285 | // To limit FPS at ~60 286 | // glfw.swapInterval(1); 287 | 288 | do { 289 | const now = performance.now(); 290 | while (times.length > 0 && times[0] <= now - 1000) { 291 | times.shift(); 292 | } 293 | times.push(now); 294 | fps = times.length; 295 | glfw.setWindowTitle(win, cstr(`Hello World | ${fps} FPS`)); 296 | 297 | gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT); 298 | 299 | gl.useProgram(programID); 300 | 301 | gl.uniformMatrix4fv(matrixID, 1, gl.FALSE, mvp.toFloat32Array()); 302 | 303 | gl.enableVertexAttribArray(0); 304 | gl.bindBuffer(gl.ARRAY_BUFFER, vertexBuffer[0]); 305 | gl.vertexAttribPointer( 306 | 0, 307 | 3, 308 | gl.FLOAT, 309 | gl.FALSE, 310 | 0, 311 | null, 312 | ); 313 | 314 | gl.enableVertexAttribArray(1); 315 | gl.bindBuffer(gl.ARRAY_BUFFER, colorBuffer[0]); 316 | gl.vertexAttribPointer( 317 | 1, 318 | 3, 319 | gl.FLOAT, 320 | gl.FALSE, 321 | 0, 322 | null, 323 | ); 324 | 325 | gl.drawArrays(gl.TRIANGLES, 0, 3 * 12); 326 | 327 | gl.disableVertexAttribArray(0); 328 | 329 | glfw.swapBuffers(win); 330 | glfw.pollEvents(); 331 | } while (!glfw.windowShouldClose(win) && !glfw.getKey(win, glfw.KEY_ESCAPE)); 332 | 333 | gl.deleteBuffers(2, new Uint32Array([...vertexBuffer, ...colorBuffer])); 334 | gl.deleteVertexArrays(1, vao); 335 | gl.deleteProgram(programID); 336 | 337 | glfw.terminate(); 338 | -------------------------------------------------------------------------------- /examples/three.js: -------------------------------------------------------------------------------- 1 | // Copied from https://github.com/mrdoob/three.js/blob/master/examples/webgl_interactive_cubes_gpu.html 2 | // Copyright © 2010-2021 three.js authors 3 | 4 | import { Canvas } from "../mod.ts"; 5 | import * as THREE from "https://raw.githubusercontent.com/mrdoob/three.js/master/build/three.module.js"; 6 | import * as BufferGeometryUtils from "https://raw.githubusercontent.com/mrdoob/three.js/master/examples/jsm/utils/BufferGeometryUtils.js"; 7 | import { TrackballControls } from "https://raw.githubusercontent.com/mrdoob/three.js/master/examples/jsm/controls/TrackballControls.js"; 8 | 9 | const canvas = new Canvas({ 10 | title: "THREE.js Interactive Example", 11 | width: 1200, 12 | height: 680, 13 | resizable: true, 14 | }); 15 | 16 | let prevW = canvas.width; 17 | let prevH = canvas.height; 18 | 19 | let camera, controls, scene, renderer; 20 | let pickingTexture, pickingScene; 21 | let highlightBox; 22 | 23 | const pickingData = []; 24 | 25 | const pointer = new THREE.Vector2(); 26 | const offset = new THREE.Vector3(10, 10, 10); 27 | 28 | init(); 29 | animate(); 30 | 31 | function init() { 32 | camera = new THREE.PerspectiveCamera( 33 | 70, 34 | window.innerWidth / window.innerHeight, 35 | 1, 36 | 10000, 37 | ); 38 | camera.position.z = 1000; 39 | 40 | scene = new THREE.Scene(); 41 | scene.background = new THREE.Color(0xffffff); 42 | 43 | pickingScene = new THREE.Scene(); 44 | pickingTexture = new THREE.WebGLRenderTarget(1, 1); 45 | 46 | scene.add(new THREE.AmbientLight(0x555555)); 47 | 48 | const light = new THREE.SpotLight(0xffffff, 1.5); 49 | light.position.set(0, 500, 2000); 50 | scene.add(light); 51 | 52 | const pickingMaterial = new THREE.MeshBasicMaterial({ vertexColors: true }); 53 | const defaultMaterial = new THREE.MeshPhongMaterial({ 54 | color: 0xffffff, 55 | flatShading: true, 56 | vertexColors: true, 57 | shininess: 0, 58 | }); 59 | 60 | function applyVertexColors(geometry, color) { 61 | const position = geometry.attributes.position; 62 | const colors = []; 63 | 64 | for (let i = 0; i < position.count; i++) { 65 | colors.push(color.r, color.g, color.b); 66 | } 67 | 68 | geometry.setAttribute("color", new THREE.Float32BufferAttribute(colors, 3)); 69 | } 70 | 71 | const geometriesDrawn = []; 72 | const geometriesPicking = []; 73 | 74 | const matrix = new THREE.Matrix4(); 75 | const quaternion = new THREE.Quaternion(); 76 | const color = new THREE.Color(); 77 | 78 | for (let i = 0; i < 5000; i++) { 79 | let geometry = new THREE.BoxGeometry(); 80 | 81 | const position = new THREE.Vector3(); 82 | position.x = Math.random() * 10000 - 5000; 83 | position.y = Math.random() * 6000 - 3000; 84 | position.z = Math.random() * 8000 - 4000; 85 | 86 | const rotation = new THREE.Euler(); 87 | rotation.x = Math.random() * 2 * Math.PI; 88 | rotation.y = Math.random() * 2 * Math.PI; 89 | rotation.z = Math.random() * 2 * Math.PI; 90 | 91 | const scale = new THREE.Vector3(); 92 | scale.x = Math.random() * 200 + 100; 93 | scale.y = Math.random() * 200 + 100; 94 | scale.z = Math.random() * 200 + 100; 95 | 96 | quaternion.setFromEuler(rotation); 97 | matrix.compose(position, quaternion, scale); 98 | 99 | geometry.applyMatrix4(matrix); 100 | 101 | // give the geometry's vertices a random color, to be displayed 102 | 103 | applyVertexColors(geometry, color.setHex(Math.random() * 0xffffff)); 104 | 105 | geometriesDrawn.push(geometry); 106 | 107 | geometry = geometry.clone(); 108 | 109 | // give the geometry's vertices a color corresponding to the "id" 110 | 111 | applyVertexColors(geometry, color.setHex(i)); 112 | 113 | geometriesPicking.push(geometry); 114 | 115 | pickingData[i] = { 116 | position: position, 117 | rotation: rotation, 118 | scale: scale, 119 | }; 120 | } 121 | 122 | const objects = new THREE.Mesh( 123 | BufferGeometryUtils.mergeBufferGeometries(geometriesDrawn), 124 | defaultMaterial, 125 | ); 126 | scene.add(objects); 127 | 128 | pickingScene.add( 129 | new THREE.Mesh( 130 | BufferGeometryUtils.mergeBufferGeometries(geometriesPicking), 131 | pickingMaterial, 132 | ), 133 | ); 134 | 135 | highlightBox = new THREE.Mesh( 136 | new THREE.BoxGeometry(), 137 | new THREE.MeshLambertMaterial({ color: 0xffff00 }), 138 | ); 139 | scene.add(highlightBox); 140 | 141 | renderer = new THREE.WebGLRenderer({ antialias: true, canvas }); 142 | renderer.setPixelRatio(window.devicePixelRatio); 143 | renderer.setSize(window.innerWidth, window.innerHeight); 144 | 145 | controls = new TrackballControls(camera, renderer.domElement); 146 | controls.rotateSpeed = 1.0; 147 | controls.zoomSpeed = 1.2; 148 | controls.panSpeed = 0.8; 149 | controls.noZoom = false; 150 | controls.noPan = false; 151 | controls.staticMoving = true; 152 | controls.dynamicDampingFactor = 0.3; 153 | 154 | renderer.domElement.addEventListener("pointermove", onPointerMove); 155 | } 156 | 157 | // 158 | 159 | function onPointerMove(e) { 160 | pointer.x = e.clientX; 161 | pointer.y = e.clientY; 162 | } 163 | 164 | function animate() { 165 | if (canvas.shouldClose()) return; 166 | requestAnimationFrame(animate); 167 | canvas.updateEvents(); 168 | render(); 169 | } 170 | 171 | function pick() { 172 | //render the picking scene off-screen 173 | 174 | // set the view offset to represent just a single pixel under the mouse 175 | 176 | camera.setViewOffset( 177 | renderer.domElement.width, 178 | renderer.domElement.height, 179 | pointer.x * window.devicePixelRatio | 0, 180 | pointer.y * window.devicePixelRatio | 0, 181 | 1, 182 | 1, 183 | ); 184 | 185 | // render the scene 186 | 187 | renderer.setRenderTarget(pickingTexture); 188 | renderer.render(pickingScene, camera); 189 | 190 | // clear the view offset so rendering returns to normal 191 | 192 | camera.clearViewOffset(); 193 | 194 | //create buffer for reading single pixel 195 | 196 | const pixelBuffer = new Uint8Array(4); 197 | 198 | //read the pixel 199 | 200 | renderer.readRenderTargetPixels(pickingTexture, 0, 0, 1, 1, pixelBuffer); 201 | 202 | //interpret the pixel as an ID 203 | 204 | const id = (pixelBuffer[0] << 16) | (pixelBuffer[1] << 8) | (pixelBuffer[2]); 205 | const data = pickingData[id]; 206 | 207 | if (data) { 208 | //move our highlightBox so that it surrounds the picked object 209 | 210 | if (data.position && data.rotation && data.scale) { 211 | highlightBox.position.copy(data.position); 212 | highlightBox.rotation.copy(data.rotation); 213 | highlightBox.scale.copy(data.scale).add(offset); 214 | highlightBox.visible = true; 215 | } 216 | } else { 217 | highlightBox.visible = false; 218 | } 219 | } 220 | 221 | function onWindowResize() { 222 | camera.aspect = window.innerWidth / window.innerHeight; 223 | camera.updateProjectionMatrix(); 224 | renderer.setSize(window.innerWidth, window.innerHeight); 225 | } 226 | 227 | function render() { 228 | if (prevW !== canvas.width || prevH !== canvas.height) { 229 | onWindowResize(); 230 | prevW = canvas.width; 231 | prevH = canvas.height; 232 | } 233 | 234 | controls.update(); 235 | 236 | pick(); 237 | 238 | renderer.setRenderTarget(null); 239 | renderer.render(scene, camera); 240 | 241 | canvas.swapBuffers(); 242 | } 243 | -------------------------------------------------------------------------------- /mod.ts: -------------------------------------------------------------------------------- 1 | export * from "./src/core/mod.ts"; 2 | export * from "./src/web/mod.ts"; 3 | -------------------------------------------------------------------------------- /src/core/README.md: -------------------------------------------------------------------------------- 1 | # deno_gl/core 2 | 3 | Low-level OpenGL/GLFW bindings. 4 | -------------------------------------------------------------------------------- /src/core/const.ts: -------------------------------------------------------------------------------- 1 | export class GLFW_KEYS { 2 | KEY_SPACE = 32; 3 | KEY_APOSTROPHE = 39; 4 | KEY_COMMA = 44; 5 | KEY_MINUS = 45; 6 | KEY_PERIOD = 46; 7 | KEY_SLASH = 47; 8 | KEY_0 = 48; 9 | KEY_1 = 49; 10 | KEY_2 = 50; 11 | KEY_3 = 51; 12 | KEY_4 = 52; 13 | KEY_5 = 53; 14 | KEY_6 = 54; 15 | KEY_7 = 55; 16 | KEY_8 = 56; 17 | KEY_9 = 57; 18 | KEY_SEMICOLON = 59; 19 | KEY_EQUAL = 61; 20 | KEY_A = 65; 21 | KEY_B = 66; 22 | KEY_C = 67; 23 | KEY_D = 68; 24 | KEY_E = 69; 25 | KEY_F = 70; 26 | KEY_G = 71; 27 | KEY_H = 72; 28 | KEY_I = 73; 29 | KEY_J = 74; 30 | KEY_K = 75; 31 | KEY_L = 76; 32 | KEY_M = 77; 33 | KEY_N = 78; 34 | KEY_O = 79; 35 | KEY_P = 80; 36 | KEY_Q = 81; 37 | KEY_R = 82; 38 | KEY_S = 83; 39 | KEY_T = 84; 40 | KEY_U = 85; 41 | KEY_V = 86; 42 | KEY_W = 87; 43 | KEY_X = 88; 44 | KEY_Y = 89; 45 | KEY_Z = 90; 46 | KEY_LEFT_BRACKET = 91; 47 | KEY_BACKSLASH = 92; 48 | KEY_RIGHT_BRACKET = 93; 49 | KEY_GRAVE_ACCENT = 96; 50 | KEY_WORLD_1 = 161; 51 | KEY_WORLD_2 = 162; 52 | KEY_ESCAPE = 256; 53 | KEY_ENTER = 257; 54 | KEY_TAB = 258; 55 | KEY_BACKSPACE = 259; 56 | KEY_INSERT = 260; 57 | KEY_DELETE = 261; 58 | KEY_RIGHT = 262; 59 | KEY_LEFT = 263; 60 | KEY_DOWN = 264; 61 | KEY_UP = 265; 62 | KEY_PAGE_UP = 266; 63 | KEY_PAGE_DOWN = 267; 64 | KEY_HOME = 268; 65 | KEY_END = 269; 66 | KEY_CAPS_LOCK = 280; 67 | KEY_SCROLL_LOCK = 281; 68 | KEY_NUM_LOCK = 282; 69 | KEY_PRINT_SCREEN = 283; 70 | KEY_PAUSE = 284; 71 | KEY_F1 = 290; 72 | KEY_F2 = 291; 73 | KEY_F3 = 292; 74 | KEY_F4 = 293; 75 | KEY_F5 = 294; 76 | KEY_F6 = 295; 77 | KEY_F7 = 296; 78 | KEY_F8 = 297; 79 | KEY_F9 = 298; 80 | KEY_F10 = 299; 81 | KEY_F11 = 300; 82 | KEY_F12 = 301; 83 | KEY_F13 = 302; 84 | KEY_F14 = 303; 85 | KEY_F15 = 304; 86 | KEY_F16 = 305; 87 | KEY_F17 = 306; 88 | KEY_F18 = 307; 89 | KEY_F19 = 308; 90 | KEY_F20 = 309; 91 | KEY_F21 = 310; 92 | KEY_F22 = 311; 93 | KEY_F23 = 312; 94 | KEY_F24 = 313; 95 | KEY_F25 = 314; 96 | KEY_KP_0 = 320; 97 | KEY_KP_1 = 321; 98 | KEY_KP_2 = 322; 99 | KEY_KP_3 = 323; 100 | KEY_KP_4 = 324; 101 | KEY_KP_5 = 325; 102 | KEY_KP_6 = 326; 103 | KEY_KP_7 = 327; 104 | KEY_KP_8 = 328; 105 | KEY_KP_9 = 329; 106 | KEY_KP_DECIMAL = 330; 107 | KEY_KP_DIVIDE = 331; 108 | KEY_KP_MULTIPLY = 332; 109 | KEY_KP_SUBTRACT = 333; 110 | KEY_KP_ADD = 334; 111 | KEY_KP_ENTER = 335; 112 | KEY_KP_EQUAL = 336; 113 | KEY_LEFT_SHIFT = 340; 114 | KEY_LEFT_CONTROL = 341; 115 | KEY_LEFT_ALT = 342; 116 | KEY_LEFT_SUPER = 343; 117 | KEY_RIGHT_SHIFT = 344; 118 | KEY_RIGHT_CONTROL = 345; 119 | KEY_RIGHT_ALT = 346; 120 | KEY_RIGHT_SUPER = 347; 121 | KEY_MENU = 348; 122 | } 123 | 124 | export class GLFW_CONST extends GLFW_KEYS { 125 | TRUE = 1; 126 | FALSE = 0; 127 | JOYSTICK_HAT_BUTTONS = 0x00050001; 128 | COCOA_CHDIR_RESOURCES = 0x00051001; 129 | COCOA_MENUBAR = 0x00051002; 130 | FOCUSED = 0x00020001; 131 | ICONIFIED = 0x00020002; 132 | RESIZABLE = 0x00020003; 133 | VISIBLE = 0x00020004; 134 | DECORATED = 0x0002005; 135 | AUTO_ICONIFY = 0x0002006; 136 | FLOATING = 0x0002007; 137 | MAXIMIZED = 0x0002008; 138 | CENTER_CURSOR = 0x0002009; 139 | TRANSPARENT_FRAMEBUFFER = 0x000200A; 140 | HOVERED = 0x000200B; 141 | FOCUS_ON_SHOW = 0x000200C; 142 | RED_BITS = 0x00021001; 143 | GREEN_BITS = 0x00021002; 144 | BLUE_BITS = 0x00021003; 145 | ALPHA_BITS = 0x00021004; 146 | DEPTH_BITS = 0x00021005; 147 | STENCIL_BITS = 0x00021006; 148 | ACCUM_RED_BITS = 0x00021007; 149 | ACCUM_GREEN_BITS = 0x00021008; 150 | ACCUM_BLUE_BITS = 0x00021009; 151 | ACCUM_ALPHA_BITS = 0x0002100A; 152 | AUX_BUFFERS = 0x0002100B; 153 | STEREO = 0x0002100C; 154 | SAMPLES = 0x0002100D; 155 | SRGB_CAPABLE = 0x0002100E; 156 | REFRESH_RATE = 0x0002100F; 157 | DOUBLEBUFFER = 0x00021010; 158 | CLIENT_API = 0x00022001; 159 | CONTEXT_VERSION_MAJOR = 0x00022002; 160 | CONTEXT_VERSION_MINOR = 0x00022003; 161 | CONTEXT_REVISION = 0x00022004; 162 | CONTEXT_ROBUSTNESS = 0x00022005; 163 | OPENGL_FORWARD_COMPAT = 0x00022006; 164 | OPENGL_DEBUG_CONTEXT = 0x00022007; 165 | OPENGL_PROFILE = 0x00022008; 166 | CONTEXT_RELEASE_BEHAVIOR = 0x00022009; 167 | CONTEXT_NO_ERROR = 0x0002200A; 168 | CONTEXT_CREATION_API = 0x0002200B; 169 | SCALE_TO_MONITOR = 0x0002200C; 170 | COCOA_RETINA_FRAMEBUFFER = 0x00023001; 171 | COCOA_FRAME_NAME = 0x00023002; 172 | COCOA_GRAPHICS_SWITCHING = 0x00023003; 173 | X11_CLASS_NAME = 0x00024001; 174 | X11_INSTANCE_NAME = 0x00024002; 175 | OPENGL_CORE_PROFILE = 0x00032001; 176 | STICKY_KEYS = 0x00033002; 177 | GAMEPAD_AXIS_LEFT_X = 0; 178 | GAMEPAD_AXIS_LEFT_Y = 1; 179 | GAMEPAD_AXIS_RIGHT_X = 2; 180 | GAMEPAD_AXIS_RIGHT_Y = 3; 181 | GAMEPAD_AXIS_LEFT_TRIGGER = 4; 182 | GAMEPAD_AXIS_RIGHT_TRIGGER = 5; 183 | GAMEPAD_AXIS_LAST = 5; 184 | GAMEPAD_BUTTON_A = 0; 185 | GAMEPAD_BUTTON_B = 1; 186 | GAMEPAD_BUTTON_X = 2; 187 | GAMEPAD_BUTTON_Y = 3; 188 | GAMEPAD_BUTTON_LEFT_BUMPER = 4; 189 | GAMEPAD_BUTTON_RIGHT_BUMPER = 5; 190 | GAMEPAD_BUTTON_BACK = 6; 191 | GAMEPAD_BUTTON_START = 7; 192 | GAMEPAD_BUTTON_GUIDE = 8; 193 | GAMEPAD_BUTTON_LEFT_THUMB = 9; 194 | GAMEPAD_BUTTON_RIGHT_THUMB = 10; 195 | GAMEPAD_BUTTON_DPAD_UP = 11; 196 | GAMEPAD_BUTTON_DPAD_RIGHT = 12; 197 | GAMEPAD_BUTTON_DPAD_DOWN = 13; 198 | GAMEPAD_BUTTON_DPAD_LEFT = 14; 199 | GAMEPAD_BUTTON_LAST = 14; 200 | GAMEPAD_BUTTON_CROSS = 0; 201 | GAMEPAD_BUTTON_CIRCLE = 1; 202 | GAMEPAD_BUTTON_SQUARE = 2; 203 | GAMEPAD_BUTTON_TRIANGLE = 3; 204 | HAT_CENTERED = 0; 205 | HAT_UP = 1; 206 | HAT_RIGHT = 2; 207 | HAT_DOWN = 4; 208 | HAT_LEFT = 8; 209 | HAT_RIGHT_UP = 3; 210 | HAT_RIGHT_DOWN = 6; 211 | HAT_LEFT_UP = 9; 212 | HAT_LEFT_DOWN = 12; 213 | JOYSTICK_1 = 0; 214 | JOYSTICK_2 = 1; 215 | JOYSTICK_3 = 2; 216 | JOYSTICK_4 = 3; 217 | JOYSTICK_5 = 4; 218 | JOYSTICK_6 = 5; 219 | JOYSTICK_7 = 6; 220 | JOYSTICK_8 = 7; 221 | JOYSTICK_9 = 8; 222 | JOYSTICK_10 = 9; 223 | JOYSTICK_11 = 10; 224 | JOYSTICK_12 = 11; 225 | JOYSTICK_13 = 12; 226 | JOYSTICK_14 = 13; 227 | JOYSTICK_15 = 14; 228 | JOYSTICK_16 = 15; 229 | JOYSTICK_LAST = 15; 230 | KEY_UNKNOWN = -1; 231 | KEY_LAST = 348; 232 | MOD_SHIFT = 0x0001; 233 | MOD_CONTROL = 0x0002; 234 | MOD_ALT = 0x0004; 235 | MOD_SUPER = 0x0008; 236 | MOUSE_BUTTON_1 = 0; 237 | MOUSE_BUTTON_2 = 1; 238 | MOUSE_BUTTON_3 = 2; 239 | MOUSE_BUTTON_4 = 3; 240 | MOUSE_BUTTON_5 = 4; 241 | MOUSE_BUTTON_6 = 5; 242 | MOUSE_BUTTON_7 = 6; 243 | MOUSE_BUTTON_8 = 7; 244 | MOUSE_BUTTON_LAST = 7; 245 | MOUSE_BUTTON_LEFT = 0; 246 | MOUSE_BUTTON_RIGHT = 1; 247 | MOUSE_BUTTON_MIDDLE = 2; 248 | ARROW_CURSOR = 0x00036001; 249 | IBEAM_CURSOR = 0x00036002; 250 | CROSSHAIR_CURSOR = 0x00036003; 251 | HAND_CURSOR = 0x00036004; 252 | HRESIZE_CURSOR = 0x00036005; 253 | VRESIZE_CURSOR = 0x00036006; 254 | OPENGL_API = 0x00032001; 255 | OPENGL_ANY_PROFILE = 0; 256 | OPENGL_ES_API = 0x00030002; 257 | CURSOR = 0x00033001; 258 | CURSOR_NORMAL = 0x00034001; 259 | CURSOR_HIDDEN = 0x00034002; 260 | CURSOR_DISABLED = 0x00034003; 261 | EGL_CONTEXT_API = 0x00036002; 262 | } 263 | 264 | export class GL_CONST { 265 | ZERO = 0; 266 | FALSE = 0; 267 | LOGIC_OP = 0x0BF1; 268 | NONE = 0; 269 | TEXTURE_COMPONENTS = 0x1003; 270 | NO_ERROR = 0; 271 | POINTS = 0x0000; 272 | CURRENT_BIT = 0x00000001; 273 | TRUE = 1; 274 | ONE = 1; 275 | CLIENT_PIXEL_STORE_BIT = 0x00000001; 276 | LINES = 0x0001; 277 | LINE_LOOP = 0x0002; 278 | POINT_BIT = 0x00000002; 279 | CLIENT_VERTEX_ARRAY_BIT = 0x00000002; 280 | LINE_STRIP = 0x0003; 281 | LINE_BIT = 0x00000004; 282 | TRIANGLES = 0x0004; 283 | TRIANGLE_STRIP = 0x0005; 284 | TRIANGLE_FAN = 0x0006; 285 | QUADS = 0x0007; 286 | QUAD_STRIP = 0x0008; 287 | POLYGON_BIT = 0x00000008; 288 | POLYGON = 0x0009; 289 | POLYGON_STIPPLE_BIT = 0x00000010; 290 | PIXEL_MODE_BIT = 0x00000020; 291 | LIGHTING_BIT = 0x00000040; 292 | FOG_BIT = 0x00000080; 293 | DEPTH_BUFFER_BIT = 0x00000100; 294 | ACCUM = 0x0100; 295 | LOAD = 0x0101; 296 | RETURN = 0x0102; 297 | MULT = 0x0103; 298 | ADD = 0x0104; 299 | NEVER = 0x0200; 300 | ACCUM_BUFFER_BIT = 0x00000200; 301 | LESS = 0x0201; 302 | EQUAL = 0x0202; 303 | LEQUAL = 0x0203; 304 | GREATER = 0x0204; 305 | NOTEQUAL = 0x0205; 306 | GEQUAL = 0x0206; 307 | ALWAYS = 0x0207; 308 | SRC_COLOR = 0x0300; 309 | ONE_MINUS_SRC_COLOR = 0x0301; 310 | SRC_ALPHA = 0x0302; 311 | ONE_MINUS_SRC_ALPHA = 0x0303; 312 | DST_ALPHA = 0x0304; 313 | ONE_MINUS_DST_ALPHA = 0x0305; 314 | DST_COLOR = 0x0306; 315 | ONE_MINUS_DST_COLOR = 0x0307; 316 | SRC_ALPHA_SATURATE = 0x0308; 317 | STENCIL_BUFFER_BIT = 0x00000400; 318 | FRONT_LEFT = 0x0400; 319 | FRONT_RIGHT = 0x0401; 320 | BACK_LEFT = 0x0402; 321 | BACK_RIGHT = 0x0403; 322 | FRONT = 0x0404; 323 | BACK = 0x0405; 324 | LEFT = 0x0406; 325 | RIGHT = 0x0407; 326 | FRONT_AND_BACK = 0x0408; 327 | AUX0 = 0x0409; 328 | AUX1 = 0x040A; 329 | AUX2 = 0x040B; 330 | AUX3 = 0x040C; 331 | INVALID_ENUM = 0x0500; 332 | INVALID_VALUE = 0x0501; 333 | INVALID_OPERATION = 0x0502; 334 | STACK_OVERFLOW = 0x0503; 335 | STACK_UNDERFLOW = 0x0504; 336 | OUT_OF_MEMORY = 0x0505; 337 | "2D" = 0x0600; 338 | "3D" = 0x0601; 339 | "3D_COLOR" = 0x0602; 340 | "3D_COLOR_TEXTURE" = 0x0603; 341 | "4D_COLOR_TEXTURE" = 0x0604; 342 | PASS_THROUGH_TOKEN = 0x0700; 343 | POINT_TOKEN = 0x0701; 344 | LINE_TOKEN = 0x0702; 345 | POLYGON_TOKEN = 0x0703; 346 | BITMAP_TOKEN = 0x0704; 347 | DRAW_PIXEL_TOKEN = 0x0705; 348 | COPY_PIXEL_TOKEN = 0x0706; 349 | LINE_RESET_TOKEN = 0x0707; 350 | EXP = 0x0800; 351 | VIEWPORT_BIT = 0x00000800; 352 | EXP2 = 0x0801; 353 | CW = 0x0900; 354 | CCW = 0x0901; 355 | COEFF = 0x0A00; 356 | ORDER = 0x0A01; 357 | DOMAIN = 0x0A02; 358 | CURRENT_COLOR = 0x0B00; 359 | CURRENT_INDEX = 0x0B01; 360 | CURRENT_NORMAL = 0x0B02; 361 | CURRENT_TEXTURE_COORDS = 0x0B03; 362 | CURRENT_RASTER_COLOR = 0x0B04; 363 | CURRENT_RASTER_INDEX = 0x0B05; 364 | CURRENT_RASTER_TEXTURE_COORDS = 0x0B06; 365 | CURRENT_RASTER_POSITION = 0x0B07; 366 | CURRENT_RASTER_POSITION_VALID = 0x0B08; 367 | CURRENT_RASTER_DISTANCE = 0x0B09; 368 | POINT_SMOOTH = 0x0B10; 369 | POINT_SIZE = 0x0B11; 370 | POINT_SIZE_RANGE = 0x0B12; 371 | POINT_SIZE_GRANULARITY = 0x0B13; 372 | LINE_SMOOTH = 0x0B20; 373 | LINE_WIDTH = 0x0B21; 374 | LINE_WIDTH_RANGE = 0x0B22; 375 | LINE_WIDTH_GRANULARITY = 0x0B23; 376 | LINE_STIPPLE = 0x0B24; 377 | LINE_STIPPLE_PATTERN = 0x0B25; 378 | LINE_STIPPLE_REPEAT = 0x0B26; 379 | LIST_MODE = 0x0B30; 380 | MAX_LIST_NESTING = 0x0B31; 381 | LIST_BASE = 0x0B32; 382 | LIST_INDEX = 0x0B33; 383 | POLYGON_MODE = 0x0B40; 384 | POLYGON_SMOOTH = 0x0B41; 385 | POLYGON_STIPPLE = 0x0B42; 386 | EDGE_FLAG = 0x0B43; 387 | CULL_FACE = 0x0B44; 388 | CULL_FACE_MODE = 0x0B45; 389 | FRONT_FACE = 0x0B46; 390 | LIGHTING = 0x0B50; 391 | LIGHT_MODEL_LOCAL_VIEWER = 0x0B51; 392 | LIGHT_MODEL_TWO_SIDE = 0x0B52; 393 | LIGHT_MODEL_AMBIENT = 0x0B53; 394 | SHADE_MODEL = 0x0B54; 395 | COLOR_MATERIAL_FACE = 0x0B55; 396 | COLOR_MATERIAL_PARAMETER = 0x0B56; 397 | COLOR_MATERIAL = 0x0B57; 398 | FOG = 0x0B60; 399 | FOG_INDEX = 0x0B61; 400 | FOG_DENSITY = 0x0B62; 401 | FOG_START = 0x0B63; 402 | FOG_END = 0x0B64; 403 | FOG_MODE = 0x0B65; 404 | FOG_COLOR = 0x0B66; 405 | DEPTH_RANGE = 0x0B70; 406 | DEPTH_TEST = 0x0B71; 407 | DEPTH_WRITEMASK = 0x0B72; 408 | DEPTH_CLEAR_VALUE = 0x0B73; 409 | DEPTH_FUNC = 0x0B74; 410 | ACCUM_CLEAR_VALUE = 0x0B80; 411 | STENCIL_TEST = 0x0B90; 412 | STENCIL_CLEAR_VALUE = 0x0B91; 413 | STENCIL_FUNC = 0x0B92; 414 | STENCIL_VALUE_MASK = 0x0B93; 415 | STENCIL_FAIL = 0x0B94; 416 | STENCIL_PASS_DEPTH_FAIL = 0x0B95; 417 | STENCIL_PASS_DEPTH_PASS = 0x0B96; 418 | STENCIL_REF = 0x0B97; 419 | STENCIL_WRITEMASK = 0x0B98; 420 | MATRIX_MODE = 0x0BA0; 421 | NORMALIZE = 0x0BA1; 422 | VIEWPORT = 0x0BA2; 423 | MODELVIEW_STACK_DEPTH = 0x0BA3; 424 | PROJECTION_STACK_DEPTH = 0x0BA4; 425 | TEXTURE_STACK_DEPTH = 0x0BA5; 426 | MODELVIEW_MATRIX = 0x0BA6; 427 | PROJECTION_MATRIX = 0x0BA7; 428 | TEXTURE_MATRIX = 0x0BA8; 429 | ATTRIB_STACK_DEPTH = 0x0BB0; 430 | CLIENT_ATTRIB_STACK_DEPTH = 0x0BB1; 431 | ALPHA_TEST = 0x0BC0; 432 | ALPHA_TEST_FUNC = 0x0BC1; 433 | ALPHA_TEST_REF = 0x0BC2; 434 | DITHER = 0x0BD0; 435 | BLEND_DST = 0x0BE0; 436 | BLEND_SRC = 0x0BE1; 437 | BLEND = 0x0BE2; 438 | LOGIC_OP_MODE = 0x0BF0; 439 | INDEX_LOGIC_OP = 0x0BF1; 440 | COLOR_LOGIC_OP = 0x0BF2; 441 | AUX_BUFFERS = 0x0C00; 442 | DRAW_BUFFER = 0x0C01; 443 | READ_BUFFER = 0x0C02; 444 | SCISSOR_BOX = 0x0C10; 445 | SCISSOR_TEST = 0x0C11; 446 | INDEX_CLEAR_VALUE = 0x0C20; 447 | INDEX_WRITEMASK = 0x0C21; 448 | COLOR_CLEAR_VALUE = 0x0C22; 449 | COLOR_WRITEMASK = 0x0C23; 450 | INDEX_MODE = 0x0C30; 451 | RGBA_MODE = 0x0C31; 452 | DOUBLEBUFFER = 0x0C32; 453 | STEREO = 0x0C33; 454 | RENDER_MODE = 0x0C40; 455 | PERSPECTIVE_CORRECTION_HINT = 0x0C50; 456 | POINT_SMOOTH_HINT = 0x0C51; 457 | LINE_SMOOTH_HINT = 0x0C52; 458 | POLYGON_SMOOTH_HINT = 0x0C53; 459 | FOG_HINT = 0x0C54; 460 | TEXTURE_GEN_S = 0x0C60; 461 | TEXTURE_GEN_T = 0x0C61; 462 | TEXTURE_GEN_R = 0x0C62; 463 | TEXTURE_GEN_Q = 0x0C63; 464 | PIXEL_MAP_I_TO_I = 0x0C70; 465 | PIXEL_MAP_S_TO_S = 0x0C71; 466 | PIXEL_MAP_I_TO_R = 0x0C72; 467 | PIXEL_MAP_I_TO_G = 0x0C73; 468 | PIXEL_MAP_I_TO_B = 0x0C74; 469 | PIXEL_MAP_I_TO_A = 0x0C75; 470 | PIXEL_MAP_R_TO_R = 0x0C76; 471 | PIXEL_MAP_G_TO_G = 0x0C77; 472 | PIXEL_MAP_B_TO_B = 0x0C78; 473 | PIXEL_MAP_A_TO_A = 0x0C79; 474 | PIXEL_MAP_I_TO_I_SIZE = 0x0CB0; 475 | PIXEL_MAP_S_TO_S_SIZE = 0x0CB1; 476 | PIXEL_MAP_I_TO_R_SIZE = 0x0CB2; 477 | PIXEL_MAP_I_TO_G_SIZE = 0x0CB3; 478 | PIXEL_MAP_I_TO_B_SIZE = 0x0CB4; 479 | PIXEL_MAP_I_TO_A_SIZE = 0x0CB5; 480 | PIXEL_MAP_R_TO_R_SIZE = 0x0CB6; 481 | PIXEL_MAP_G_TO_G_SIZE = 0x0CB7; 482 | PIXEL_MAP_B_TO_B_SIZE = 0x0CB8; 483 | PIXEL_MAP_A_TO_A_SIZE = 0x0CB9; 484 | UNPACK_SWAP_BYTES = 0x0CF0; 485 | UNPACK_LSB_FIRST = 0x0CF1; 486 | UNPACK_ROW_LENGTH = 0x0CF2; 487 | UNPACK_SKIP_ROWS = 0x0CF3; 488 | UNPACK_SKIP_PIXELS = 0x0CF4; 489 | UNPACK_ALIGNMENT = 0x0CF5; 490 | PACK_SWAP_BYTES = 0x0D00; 491 | PACK_LSB_FIRST = 0x0D01; 492 | PACK_ROW_LENGTH = 0x0D02; 493 | PACK_SKIP_ROWS = 0x0D03; 494 | PACK_SKIP_PIXELS = 0x0D04; 495 | PACK_ALIGNMENT = 0x0D05; 496 | MAP_COLOR = 0x0D10; 497 | MAP_STENCIL = 0x0D11; 498 | INDEX_SHIFT = 0x0D12; 499 | INDEX_OFFSET = 0x0D13; 500 | RED_SCALE = 0x0D14; 501 | RED_BIAS = 0x0D15; 502 | ZOOM_X = 0x0D16; 503 | ZOOM_Y = 0x0D17; 504 | GREEN_SCALE = 0x0D18; 505 | GREEN_BIAS = 0x0D19; 506 | BLUE_SCALE = 0x0D1A; 507 | BLUE_BIAS = 0x0D1B; 508 | ALPHA_SCALE = 0x0D1C; 509 | ALPHA_BIAS = 0x0D1D; 510 | DEPTH_SCALE = 0x0D1E; 511 | DEPTH_BIAS = 0x0D1F; 512 | MAX_EVAL_ORDER = 0x0D30; 513 | MAX_LIGHTS = 0x0D31; 514 | MAX_CLIP_PLANES = 0x0D32; 515 | MAX_TEXTURE_SIZE = 0x0D33; 516 | MAX_PIXEL_MAP_TABLE = 0x0D34; 517 | MAX_ATTRIB_STACK_DEPTH = 0x0D35; 518 | MAX_MODELVIEW_STACK_DEPTH = 0x0D36; 519 | MAX_NAME_STACK_DEPTH = 0x0D37; 520 | MAX_PROJECTION_STACK_DEPTH = 0x0D38; 521 | MAX_TEXTURE_STACK_DEPTH = 0x0D39; 522 | MAX_VIEWPORT_DIMS = 0x0D3A; 523 | MAX_CLIENT_ATTRIB_STACK_DEPTH = 0x0D3B; 524 | SUBPIXEL_BITS = 0x0D50; 525 | INDEX_BITS = 0x0D51; 526 | RED_BITS = 0x0D52; 527 | GREEN_BITS = 0x0D53; 528 | BLUE_BITS = 0x0D54; 529 | ALPHA_BITS = 0x0D55; 530 | DEPTH_BITS = 0x0D56; 531 | STENCIL_BITS = 0x0D57; 532 | ACCUM_RED_BITS = 0x0D58; 533 | ACCUM_GREEN_BITS = 0x0D59; 534 | ACCUM_BLUE_BITS = 0x0D5A; 535 | ACCUM_ALPHA_BITS = 0x0D5B; 536 | NAME_STACK_DEPTH = 0x0D70; 537 | AUTO_NORMAL = 0x0D80; 538 | MAP1_COLOR_4 = 0x0D90; 539 | MAP1_INDEX = 0x0D91; 540 | MAP1_NORMAL = 0x0D92; 541 | MAP1_TEXTURE_COORD_1 = 0x0D93; 542 | MAP1_TEXTURE_COORD_2 = 0x0D94; 543 | MAP1_TEXTURE_COORD_3 = 0x0D95; 544 | MAP1_TEXTURE_COORD_4 = 0x0D96; 545 | MAP1_VERTEX_3 = 0x0D97; 546 | MAP1_VERTEX_4 = 0x0D98; 547 | MAP2_COLOR_4 = 0x0DB0; 548 | MAP2_INDEX = 0x0DB1; 549 | MAP2_NORMAL = 0x0DB2; 550 | MAP2_TEXTURE_COORD_1 = 0x0DB3; 551 | MAP2_TEXTURE_COORD_2 = 0x0DB4; 552 | MAP2_TEXTURE_COORD_3 = 0x0DB5; 553 | MAP2_TEXTURE_COORD_4 = 0x0DB6; 554 | MAP2_VERTEX_3 = 0x0DB7; 555 | MAP2_VERTEX_4 = 0x0DB8; 556 | MAP1_GRID_DOMAIN = 0x0DD0; 557 | MAP1_GRID_SEGMENTS = 0x0DD1; 558 | MAP2_GRID_DOMAIN = 0x0DD2; 559 | MAP2_GRID_SEGMENTS = 0x0DD3; 560 | TEXTURE_1D = 0x0DE0; 561 | TEXTURE_2D = 0x0DE1; 562 | FEEDBACK_BUFFER_POINTER = 0x0DF0; 563 | FEEDBACK_BUFFER_SIZE = 0x0DF1; 564 | FEEDBACK_BUFFER_TYPE = 0x0DF2; 565 | SELECTION_BUFFER_POINTER = 0x0DF3; 566 | SELECTION_BUFFER_SIZE = 0x0DF4; 567 | TEXTURE_WIDTH = 0x1000; 568 | TRANSFORM_BIT = 0x00001000; 569 | TEXTURE_HEIGHT = 0x1001; 570 | TEXTURE_INTERNAL_FORMAT = 0x1003; 571 | TEXTURE_BORDER_COLOR = 0x1004; 572 | TEXTURE_BORDER = 0x1005; 573 | DONT_CARE = 0x1100; 574 | FASTEST = 0x1101; 575 | NICEST = 0x1102; 576 | AMBIENT = 0x1200; 577 | DIFFUSE = 0x1201; 578 | SPECULAR = 0x1202; 579 | POSITION = 0x1203; 580 | SPOT_DIRECTION = 0x1204; 581 | SPOT_EXPONENT = 0x1205; 582 | SPOT_CUTOFF = 0x1206; 583 | CONSTANT_ATTENUATION = 0x1207; 584 | LINEAR_ATTENUATION = 0x1208; 585 | QUADRATIC_ATTENUATION = 0x1209; 586 | COMPILE = 0x1300; 587 | COMPILE_AND_EXECUTE = 0x1301; 588 | BYTE = 0x1400; 589 | UNSIGNED_BYTE = 0x1401; 590 | SHORT = 0x1402; 591 | UNSIGNED_SHORT = 0x1403; 592 | INT = 0x1404; 593 | UNSIGNED_INT = 0x1405; 594 | FLOAT = 0x1406; 595 | "2_BYTES" = 0x1407; 596 | "3_BYTES" = 0x1408; 597 | "4_BYTES" = 0x1409; 598 | DOUBLE = 0x140A; 599 | CLEAR = 0x1500; 600 | AND = 0x1501; 601 | AND_REVERSE = 0x1502; 602 | COPY = 0x1503; 603 | AND_INVERTED = 0x1504; 604 | NOOP = 0x1505; 605 | XOR = 0x1506; 606 | OR = 0x1507; 607 | NOR = 0x1508; 608 | EQUIV = 0x1509; 609 | INVERT = 0x150A; 610 | OR_REVERSE = 0x150B; 611 | COPY_INVERTED = 0x150C; 612 | OR_INVERTED = 0x150D; 613 | NAND = 0x150E; 614 | SET = 0x150F; 615 | EMISSION = 0x1600; 616 | SHININESS = 0x1601; 617 | AMBIENT_AND_DIFFUSE = 0x1602; 618 | COLOR_INDEXES = 0x1603; 619 | MODELVIEW = 0x1700; 620 | PROJECTION = 0x1701; 621 | TEXTURE = 0x1702; 622 | COLOR = 0x1800; 623 | DEPTH = 0x1801; 624 | STENCIL = 0x1802; 625 | COLOR_INDEX = 0x1900; 626 | STENCIL_INDEX = 0x1901; 627 | DEPTH_COMPONENT = 0x1902; 628 | RED = 0x1903; 629 | GREEN = 0x1904; 630 | BLUE = 0x1905; 631 | ALPHA = 0x1906; 632 | RGB = 0x1907; 633 | RGBA = 0x1908; 634 | LUMINANCE = 0x1909; 635 | LUMINANCE_ALPHA = 0x190A; 636 | BITMAP = 0x1A00; 637 | POINT = 0x1B00; 638 | LINE = 0x1B01; 639 | FILL = 0x1B02; 640 | RENDER = 0x1C00; 641 | FEEDBACK = 0x1C01; 642 | SELECT = 0x1C02; 643 | FLAT = 0x1D00; 644 | SMOOTH = 0x1D01; 645 | KEEP = 0x1E00; 646 | REPLACE = 0x1E01; 647 | INCR = 0x1E02; 648 | DECR = 0x1E03; 649 | VENDOR = 0x1F00; 650 | RENDERER = 0x1F01; 651 | VERSION = 0x1F02; 652 | EXTENSIONS = 0x1F03; 653 | S = 0x2000; 654 | ENABLE_BIT = 0x00002000; 655 | T = 0x2001; 656 | R = 0x2002; 657 | Q = 0x2003; 658 | MODULATE = 0x2100; 659 | DECAL = 0x2101; 660 | TEXTURE_ENV_MODE = 0x2200; 661 | TEXTURE_ENV_COLOR = 0x2201; 662 | TEXTURE_ENV = 0x2300; 663 | EYE_LINEAR = 0x2400; 664 | OBJECT_LINEAR = 0x2401; 665 | SPHERE_MAP = 0x2402; 666 | TEXTURE_GEN_MODE = 0x2500; 667 | OBJECT_PLANE = 0x2501; 668 | EYE_PLANE = 0x2502; 669 | NEAREST = 0x2600; 670 | LINEAR = 0x2601; 671 | NEAREST_MIPMAP_NEAREST = 0x2700; 672 | LINEAR_MIPMAP_NEAREST = 0x2701; 673 | NEAREST_MIPMAP_LINEAR = 0x2702; 674 | LINEAR_MIPMAP_LINEAR = 0x2703; 675 | TEXTURE_MAG_FILTER = 0x2800; 676 | TEXTURE_MIN_FILTER = 0x2801; 677 | TEXTURE_WRAP_S = 0x2802; 678 | TEXTURE_WRAP_T = 0x2803; 679 | CLAMP = 0x2900; 680 | REPEAT = 0x2901; 681 | POLYGON_OFFSET_UNITS = 0x2A00; 682 | POLYGON_OFFSET_POINT = 0x2A01; 683 | POLYGON_OFFSET_LINE = 0x2A02; 684 | R3_G3_B2 = 0x2A10; 685 | V2F = 0x2A20; 686 | V3F = 0x2A21; 687 | C4UB_V2F = 0x2A22; 688 | C4UB_V3F = 0x2A23; 689 | C3F_V3F = 0x2A24; 690 | N3F_V3F = 0x2A25; 691 | C4F_N3F_V3F = 0x2A26; 692 | T2F_V3F = 0x2A27; 693 | T4F_V4F = 0x2A28; 694 | T2F_C4UB_V3F = 0x2A29; 695 | T2F_C3F_V3F = 0x2A2A; 696 | T2F_N3F_V3F = 0x2A2B; 697 | T2F_C4F_N3F_V3F = 0x2A2C; 698 | T4F_C4F_N3F_V4F = 0x2A2D; 699 | CLIP_PLANE0 = 0x3000; 700 | CLIP_PLANE1 = 0x3001; 701 | CLIP_PLANE2 = 0x3002; 702 | CLIP_PLANE3 = 0x3003; 703 | CLIP_PLANE4 = 0x3004; 704 | CLIP_PLANE5 = 0x3005; 705 | LIGHT0 = 0x4000; 706 | COLOR_BUFFER_BIT = 0x00004000; 707 | LIGHT1 = 0x4001; 708 | LIGHT2 = 0x4002; 709 | LIGHT3 = 0x4003; 710 | LIGHT4 = 0x4004; 711 | LIGHT5 = 0x4005; 712 | LIGHT6 = 0x4006; 713 | LIGHT7 = 0x4007; 714 | HINT_BIT = 0x00008000; 715 | POLYGON_OFFSET_FILL = 0x8037; 716 | POLYGON_OFFSET_FACTOR = 0x8038; 717 | ALPHA4 = 0x803B; 718 | ALPHA8 = 0x803C; 719 | ALPHA12 = 0x803D; 720 | ALPHA16 = 0x803E; 721 | LUMINANCE4 = 0x803F; 722 | LUMINANCE8 = 0x8040; 723 | LUMINANCE12 = 0x8041; 724 | LUMINANCE16 = 0x8042; 725 | LUMINANCE4_ALPHA4 = 0x8043; 726 | LUMINANCE6_ALPHA2 = 0x8044; 727 | LUMINANCE8_ALPHA8 = 0x8045; 728 | LUMINANCE12_ALPHA4 = 0x8046; 729 | LUMINANCE12_ALPHA12 = 0x8047; 730 | LUMINANCE16_ALPHA16 = 0x8048; 731 | INTENSITY = 0x8049; 732 | INTENSITY4 = 0x804A; 733 | INTENSITY8 = 0x804B; 734 | INTENSITY12 = 0x804C; 735 | INTENSITY16 = 0x804D; 736 | RGB4 = 0x804F; 737 | RGB5 = 0x8050; 738 | RGB8 = 0x8051; 739 | RGB10 = 0x8052; 740 | RGB12 = 0x8053; 741 | RGB16 = 0x8054; 742 | RGBA2 = 0x8055; 743 | RGBA4 = 0x8056; 744 | RGB5_A1 = 0x8057; 745 | RGBA8 = 0x8058; 746 | RGB10_A2 = 0x8059; 747 | RGBA12 = 0x805A; 748 | RGBA16 = 0x805B; 749 | TEXTURE_RED_SIZE = 0x805C; 750 | TEXTURE_GREEN_SIZE = 0x805D; 751 | TEXTURE_BLUE_SIZE = 0x805E; 752 | TEXTURE_ALPHA_SIZE = 0x805F; 753 | TEXTURE_LUMINANCE_SIZE = 0x8060; 754 | TEXTURE_INTENSITY_SIZE = 0x8061; 755 | PROXY_TEXTURE_1D = 0x8063; 756 | PROXY_TEXTURE_2D = 0x8064; 757 | TEXTURE_PRIORITY = 0x8066; 758 | TEXTURE_RESIDENT = 0x8067; 759 | TEXTURE_BINDING_1D = 0x8068; 760 | TEXTURE_BINDING_2D = 0x8069; 761 | VERTEX_ARRAY = 0x8074; 762 | NORMAL_ARRAY = 0x8075; 763 | COLOR_ARRAY = 0x8076; 764 | INDEX_ARRAY = 0x8077; 765 | TEXTURE_COORD_ARRAY = 0x8078; 766 | EDGE_FLAG_ARRAY = 0x8079; 767 | VERTEX_ARRAY_SIZE = 0x807A; 768 | VERTEX_ARRAY_TYPE = 0x807B; 769 | VERTEX_ARRAY_STRIDE = 0x807C; 770 | NORMAL_ARRAY_TYPE = 0x807E; 771 | NORMAL_ARRAY_STRIDE = 0x807F; 772 | COLOR_ARRAY_SIZE = 0x8081; 773 | COLOR_ARRAY_TYPE = 0x8082; 774 | COLOR_ARRAY_STRIDE = 0x8083; 775 | INDEX_ARRAY_TYPE = 0x8085; 776 | INDEX_ARRAY_STRIDE = 0x8086; 777 | TEXTURE_COORD_ARRAY_SIZE = 0x8088; 778 | TEXTURE_COORD_ARRAY_TYPE = 0x8089; 779 | TEXTURE_COORD_ARRAY_STRIDE = 0x808A; 780 | EDGE_FLAG_ARRAY_STRIDE = 0x808C; 781 | VERTEX_ARRAY_POINTER = 0x808E; 782 | NORMAL_ARRAY_POINTER = 0x808F; 783 | COLOR_ARRAY_POINTER = 0x8090; 784 | INDEX_ARRAY_POINTER = 0x8091; 785 | TEXTURE_COORD_ARRAY_POINTER = 0x8092; 786 | EDGE_FLAG_ARRAY_POINTER = 0x8093; 787 | COLOR_INDEX1_EXT = 0x80E2; 788 | COLOR_INDEX2_EXT = 0x80E3; 789 | COLOR_INDEX4_EXT = 0x80E4; 790 | COLOR_INDEX8_EXT = 0x80E5; 791 | COLOR_INDEX12_EXT = 0x80E6; 792 | COLOR_INDEX16_EXT = 0x80E7; 793 | EVAL_BIT = 0x00010000; 794 | LIST_BIT = 0x00020000; 795 | TEXTURE_BIT = 0x00040000; 796 | SCISSOR_BIT = 0x00080000; 797 | ALL_ATTRIB_BITS = 0x000fffff; 798 | CLIENT_ALL_ATTRIB_BITS = 0xffffffff; 799 | SMOOTH_POINT_SIZE_RANGE = 0x0B12; 800 | SMOOTH_POINT_SIZE_GRANULARITY = 0x0B13; 801 | SMOOTH_LINE_WIDTH_RANGE = 0x0B22; 802 | SMOOTH_LINE_WIDTH_GRANULARITY = 0x0B23; 803 | UNSIGNED_BYTE_3_3_2 = 0x8032; 804 | UNSIGNED_SHORT_4_4_4_4 = 0x8033; 805 | UNSIGNED_SHORT_5_5_5_1 = 0x8034; 806 | UNSIGNED_INT_8_8_8_8 = 0x8035; 807 | UNSIGNED_INT_10_10_10_2 = 0x8036; 808 | RESCALE_NORMAL = 0x803A; 809 | TEXTURE_BINDING_3D = 0x806A; 810 | PACK_SKIP_IMAGES = 0x806B; 811 | PACK_IMAGE_HEIGHT = 0x806C; 812 | UNPACK_SKIP_IMAGES = 0x806D; 813 | UNPACK_IMAGE_HEIGHT = 0x806E; 814 | TEXTURE_3D = 0x806F; 815 | PROXY_TEXTURE_3D = 0x8070; 816 | TEXTURE_DEPTH = 0x8071; 817 | TEXTURE_WRAP_R = 0x8072; 818 | MAX_3D_TEXTURE_SIZE = 0x8073; 819 | BGR = 0x80E0; 820 | BGRA = 0x80E1; 821 | MAX_ELEMENTS_VERTICES = 0x80E8; 822 | MAX_ELEMENTS_INDICES = 0x80E9; 823 | CLAMP_TO_EDGE = 0x812F; 824 | TEXTURE_MIN_LOD = 0x813A; 825 | TEXTURE_MAX_LOD = 0x813B; 826 | TEXTURE_BASE_LEVEL = 0x813C; 827 | TEXTURE_MAX_LEVEL = 0x813D; 828 | LIGHT_MODEL_COLOR_CONTROL = 0x81F8; 829 | SINGLE_COLOR = 0x81F9; 830 | SEPARATE_SPECULAR_COLOR = 0x81FA; 831 | UNSIGNED_BYTE_2_3_3_REV = 0x8362; 832 | UNSIGNED_SHORT_5_6_5 = 0x8363; 833 | UNSIGNED_SHORT_5_6_5_REV = 0x8364; 834 | UNSIGNED_SHORT_4_4_4_4_REV = 0x8365; 835 | UNSIGNED_SHORT_1_5_5_5_REV = 0x8366; 836 | UNSIGNED_INT_8_8_8_8_REV = 0x8367; 837 | ALIASED_POINT_SIZE_RANGE = 0x846D; 838 | ALIASED_LINE_WIDTH_RANGE = 0x846E; 839 | MULTISAMPLE = 0x809D; 840 | SAMPLE_ALPHA_TO_COVERAGE = 0x809E; 841 | SAMPLE_ALPHA_TO_ONE = 0x809F; 842 | SAMPLE_COVERAGE = 0x80A0; 843 | SAMPLE_BUFFERS = 0x80A8; 844 | SAMPLES = 0x80A9; 845 | SAMPLE_COVERAGE_VALUE = 0x80AA; 846 | SAMPLE_COVERAGE_INVERT = 0x80AB; 847 | CLAMP_TO_BORDER = 0x812D; 848 | TEXTURE0 = 0x84C0; 849 | TEXTURE1 = 0x84C1; 850 | TEXTURE2 = 0x84C2; 851 | TEXTURE3 = 0x84C3; 852 | TEXTURE4 = 0x84C4; 853 | TEXTURE5 = 0x84C5; 854 | TEXTURE6 = 0x84C6; 855 | TEXTURE7 = 0x84C7; 856 | TEXTURE8 = 0x84C8; 857 | TEXTURE9 = 0x84C9; 858 | TEXTURE10 = 0x84CA; 859 | TEXTURE11 = 0x84CB; 860 | TEXTURE12 = 0x84CC; 861 | TEXTURE13 = 0x84CD; 862 | TEXTURE14 = 0x84CE; 863 | TEXTURE15 = 0x84CF; 864 | TEXTURE16 = 0x84D0; 865 | TEXTURE17 = 0x84D1; 866 | TEXTURE18 = 0x84D2; 867 | TEXTURE19 = 0x84D3; 868 | TEXTURE20 = 0x84D4; 869 | TEXTURE21 = 0x84D5; 870 | TEXTURE22 = 0x84D6; 871 | TEXTURE23 = 0x84D7; 872 | TEXTURE24 = 0x84D8; 873 | TEXTURE25 = 0x84D9; 874 | TEXTURE26 = 0x84DA; 875 | TEXTURE27 = 0x84DB; 876 | TEXTURE28 = 0x84DC; 877 | TEXTURE29 = 0x84DD; 878 | TEXTURE30 = 0x84DE; 879 | TEXTURE31 = 0x84DF; 880 | ACTIVE_TEXTURE = 0x84E0; 881 | CLIENT_ACTIVE_TEXTURE = 0x84E1; 882 | MAX_TEXTURE_UNITS = 0x84E2; 883 | TRANSPOSE_MODELVIEW_MATRIX = 0x84E3; 884 | TRANSPOSE_PROJECTION_MATRIX = 0x84E4; 885 | TRANSPOSE_TEXTURE_MATRIX = 0x84E5; 886 | TRANSPOSE_COLOR_MATRIX = 0x84E6; 887 | SUBTRACT = 0x84E7; 888 | COMPRESSED_ALPHA = 0x84E9; 889 | COMPRESSED_LUMINANCE = 0x84EA; 890 | COMPRESSED_LUMINANCE_ALPHA = 0x84EB; 891 | COMPRESSED_INTENSITY = 0x84EC; 892 | COMPRESSED_RGB = 0x84ED; 893 | COMPRESSED_RGBA = 0x84EE; 894 | TEXTURE_COMPRESSION_HINT = 0x84EF; 895 | NORMAL_MAP = 0x8511; 896 | REFLECTION_MAP = 0x8512; 897 | TEXTURE_CUBE_MAP = 0x8513; 898 | TEXTURE_BINDING_CUBE_MAP = 0x8514; 899 | TEXTURE_CUBE_MAP_POSITIVE_X = 0x8515; 900 | TEXTURE_CUBE_MAP_NEGATIVE_X = 0x8516; 901 | TEXTURE_CUBE_MAP_POSITIVE_Y = 0x8517; 902 | TEXTURE_CUBE_MAP_NEGATIVE_Y = 0x8518; 903 | TEXTURE_CUBE_MAP_POSITIVE_Z = 0x8519; 904 | TEXTURE_CUBE_MAP_NEGATIVE_Z = 0x851A; 905 | PROXY_TEXTURE_CUBE_MAP = 0x851B; 906 | MAX_CUBE_MAP_TEXTURE_SIZE = 0x851C; 907 | COMBINE = 0x8570; 908 | COMBINE_RGB = 0x8571; 909 | COMBINE_ALPHA = 0x8572; 910 | RGB_SCALE = 0x8573; 911 | ADD_SIGNED = 0x8574; 912 | INTERPOLATE = 0x8575; 913 | CONSTANT = 0x8576; 914 | PRIMARY_COLOR = 0x8577; 915 | PREVIOUS = 0x8578; 916 | SOURCE0_RGB = 0x8580; 917 | SOURCE1_RGB = 0x8581; 918 | SOURCE2_RGB = 0x8582; 919 | SOURCE0_ALPHA = 0x8588; 920 | SOURCE1_ALPHA = 0x8589; 921 | SOURCE2_ALPHA = 0x858A; 922 | OPERAND0_RGB = 0x8590; 923 | OPERAND1_RGB = 0x8591; 924 | OPERAND2_RGB = 0x8592; 925 | OPERAND0_ALPHA = 0x8598; 926 | OPERAND1_ALPHA = 0x8599; 927 | OPERAND2_ALPHA = 0x859A; 928 | TEXTURE_COMPRESSED_IMAGE_SIZE = 0x86A0; 929 | TEXTURE_COMPRESSED = 0x86A1; 930 | NUM_COMPRESSED_TEXTURE_FORMATS = 0x86A2; 931 | COMPRESSED_TEXTURE_FORMATS = 0x86A3; 932 | DOT3_RGB = 0x86AE; 933 | DOT3_RGBA = 0x86AF; 934 | MULTISAMPLE_BIT = 0x20000000; 935 | BLEND_DST_RGB = 0x80C8; 936 | BLEND_SRC_RGB = 0x80C9; 937 | BLEND_DST_ALPHA = 0x80CA; 938 | BLEND_SRC_ALPHA = 0x80CB; 939 | POINT_SIZE_MIN = 0x8126; 940 | POINT_SIZE_MAX = 0x8127; 941 | POINT_FADE_THRESHOLD_SIZE = 0x8128; 942 | POINT_DISTANCE_ATTENUATION = 0x8129; 943 | GENERATE_MIPMAP = 0x8191; 944 | GENERATE_MIPMAP_HINT = 0x8192; 945 | DEPTH_COMPONENT16 = 0x81A5; 946 | DEPTH_COMPONENT24 = 0x81A6; 947 | DEPTH_COMPONENT32 = 0x81A7; 948 | MIRRORED_REPEAT = 0x8370; 949 | FOG_COORDINATE_SOURCE = 0x8450; 950 | FOG_COORDINATE = 0x8451; 951 | FRAGMENT_DEPTH = 0x8452; 952 | CURRENT_FOG_COORDINATE = 0x8453; 953 | FOG_COORDINATE_ARRAY_TYPE = 0x8454; 954 | FOG_COORDINATE_ARRAY_STRIDE = 0x8455; 955 | FOG_COORDINATE_ARRAY_POINTER = 0x8456; 956 | FOG_COORDINATE_ARRAY = 0x8457; 957 | COLOR_SUM = 0x8458; 958 | CURRENT_SECONDARY_COLOR = 0x8459; 959 | SECONDARY_COLOR_ARRAY_SIZE = 0x845A; 960 | SECONDARY_COLOR_ARRAY_TYPE = 0x845B; 961 | SECONDARY_COLOR_ARRAY_STRIDE = 0x845C; 962 | SECONDARY_COLOR_ARRAY_POINTER = 0x845D; 963 | SECONDARY_COLOR_ARRAY = 0x845E; 964 | MAX_TEXTURE_LOD_BIAS = 0x84FD; 965 | TEXTURE_FILTER_CONTROL = 0x8500; 966 | TEXTURE_LOD_BIAS = 0x8501; 967 | INCR_WRAP = 0x8507; 968 | DECR_WRAP = 0x8508; 969 | TEXTURE_DEPTH_SIZE = 0x884A; 970 | DEPTH_TEXTURE_MODE = 0x884B; 971 | TEXTURE_COMPARE_MODE = 0x884C; 972 | TEXTURE_COMPARE_FUNC = 0x884D; 973 | COMPARE_R_TO_TEXTURE = 0x884E; 974 | CURRENT_FOG_COORD = 0x8453; 975 | FOG_COORD = 0x8451; 976 | FOG_COORD_ARRAY = 0x8457; 977 | FOG_COORD_ARRAY_BUFFER_BINDING = 0x889D; 978 | FOG_COORD_ARRAY_POINTER = 0x8456; 979 | FOG_COORD_ARRAY_STRIDE = 0x8455; 980 | FOG_COORD_ARRAY_TYPE = 0x8454; 981 | FOG_COORD_SRC = 0x8450; 982 | SRC0_ALPHA = 0x8588; 983 | SRC0_RGB = 0x8580; 984 | SRC1_ALPHA = 0x8589; 985 | SRC1_RGB = 0x8581; 986 | SRC2_ALPHA = 0x858A; 987 | SRC2_RGB = 0x8582; 988 | BUFFER_SIZE = 0x8764; 989 | BUFFER_USAGE = 0x8765; 990 | QUERY_COUNTER_BITS = 0x8864; 991 | CURRENT_QUERY = 0x8865; 992 | QUERY_RESULT = 0x8866; 993 | QUERY_RESULT_AVAILABLE = 0x8867; 994 | ARRAY_BUFFER = 0x8892; 995 | ELEMENT_ARRAY_BUFFER = 0x8893; 996 | ARRAY_BUFFER_BINDING = 0x8894; 997 | ELEMENT_ARRAY_BUFFER_BINDING = 0x8895; 998 | VERTEX_ARRAY_BUFFER_BINDING = 0x8896; 999 | NORMAL_ARRAY_BUFFER_BINDING = 0x8897; 1000 | COLOR_ARRAY_BUFFER_BINDING = 0x8898; 1001 | INDEX_ARRAY_BUFFER_BINDING = 0x8899; 1002 | TEXTURE_COORD_ARRAY_BUFFER_BINDING = 0x889A; 1003 | EDGE_FLAG_ARRAY_BUFFER_BINDING = 0x889B; 1004 | SECONDARY_COLOR_ARRAY_BUFFER_BINDING = 0x889C; 1005 | FOG_COORDINATE_ARRAY_BUFFER_BINDING = 0x889D; 1006 | WEIGHT_ARRAY_BUFFER_BINDING = 0x889E; 1007 | VERTEX_ATTRIB_ARRAY_BUFFER_BINDING = 0x889F; 1008 | READ_ONLY = 0x88B8; 1009 | WRITE_ONLY = 0x88B9; 1010 | READ_WRITE = 0x88BA; 1011 | BUFFER_ACCESS = 0x88BB; 1012 | BUFFER_MAPPED = 0x88BC; 1013 | BUFFER_MAP_POINTER = 0x88BD; 1014 | STREAM_DRAW = 0x88E0; 1015 | STREAM_READ = 0x88E1; 1016 | STREAM_COPY = 0x88E2; 1017 | STATIC_DRAW = 0x88E4; 1018 | STATIC_READ = 0x88E5; 1019 | STATIC_COPY = 0x88E6; 1020 | DYNAMIC_DRAW = 0x88E8; 1021 | DYNAMIC_READ = 0x88E9; 1022 | DYNAMIC_COPY = 0x88EA; 1023 | SAMPLES_PASSED = 0x8914; 1024 | BLEND_EQUATION_RGB = 0x8009; 1025 | VERTEX_ATTRIB_ARRAY_ENABLED = 0x8622; 1026 | VERTEX_ATTRIB_ARRAY_SIZE = 0x8623; 1027 | VERTEX_ATTRIB_ARRAY_STRIDE = 0x8624; 1028 | VERTEX_ATTRIB_ARRAY_TYPE = 0x8625; 1029 | CURRENT_VERTEX_ATTRIB = 0x8626; 1030 | VERTEX_PROGRAM_POINT_SIZE = 0x8642; 1031 | VERTEX_PROGRAM_TWO_SIDE = 0x8643; 1032 | VERTEX_ATTRIB_ARRAY_POINTER = 0x8645; 1033 | STENCIL_BACK_FUNC = 0x8800; 1034 | STENCIL_BACK_FAIL = 0x8801; 1035 | STENCIL_BACK_PASS_DEPTH_FAIL = 0x8802; 1036 | STENCIL_BACK_PASS_DEPTH_PASS = 0x8803; 1037 | MAX_DRAW_BUFFERS = 0x8824; 1038 | DRAW_BUFFER0 = 0x8825; 1039 | DRAW_BUFFER1 = 0x8826; 1040 | DRAW_BUFFER2 = 0x8827; 1041 | DRAW_BUFFER3 = 0x8828; 1042 | DRAW_BUFFER4 = 0x8829; 1043 | DRAW_BUFFER5 = 0x882A; 1044 | DRAW_BUFFER6 = 0x882B; 1045 | DRAW_BUFFER7 = 0x882C; 1046 | DRAW_BUFFER8 = 0x882D; 1047 | DRAW_BUFFER9 = 0x882E; 1048 | DRAW_BUFFER10 = 0x882F; 1049 | DRAW_BUFFER11 = 0x8830; 1050 | DRAW_BUFFER12 = 0x8831; 1051 | DRAW_BUFFER13 = 0x8832; 1052 | DRAW_BUFFER14 = 0x8833; 1053 | DRAW_BUFFER15 = 0x8834; 1054 | BLEND_EQUATION_ALPHA = 0x883D; 1055 | POINT_SPRITE = 0x8861; 1056 | COORD_REPLACE = 0x8862; 1057 | MAX_VERTEX_ATTRIBS = 0x8869; 1058 | VERTEX_ATTRIB_ARRAY_NORMALIZED = 0x886A; 1059 | MAX_TEXTURE_COORDS = 0x8871; 1060 | MAX_TEXTURE_IMAGE_UNITS = 0x8872; 1061 | FRAGMENT_SHADER = 0x8B30; 1062 | VERTEX_SHADER = 0x8B31; 1063 | MAX_FRAGMENT_UNIFORM_COMPONENTS = 0x8B49; 1064 | MAX_VERTEX_UNIFORM_COMPONENTS = 0x8B4A; 1065 | MAX_VARYING_FLOATS = 0x8B4B; 1066 | MAX_VERTEX_TEXTURE_IMAGE_UNITS = 0x8B4C; 1067 | MAX_COMBINED_TEXTURE_IMAGE_UNITS = 0x8B4D; 1068 | SHADER_TYPE = 0x8B4F; 1069 | FLOAT_VEC2 = 0x8B50; 1070 | FLOAT_VEC3 = 0x8B51; 1071 | FLOAT_VEC4 = 0x8B52; 1072 | INT_VEC2 = 0x8B53; 1073 | INT_VEC3 = 0x8B54; 1074 | INT_VEC4 = 0x8B55; 1075 | BOOL = 0x8B56; 1076 | BOOL_VEC2 = 0x8B57; 1077 | BOOL_VEC3 = 0x8B58; 1078 | BOOL_VEC4 = 0x8B59; 1079 | FLOAT_MAT2 = 0x8B5A; 1080 | FLOAT_MAT3 = 0x8B5B; 1081 | FLOAT_MAT4 = 0x8B5C; 1082 | SAMPLER_1D = 0x8B5D; 1083 | SAMPLER_2D = 0x8B5E; 1084 | SAMPLER_3D = 0x8B5F; 1085 | SAMPLER_CUBE = 0x8B60; 1086 | SAMPLER_1D_SHADOW = 0x8B61; 1087 | SAMPLER_2D_SHADOW = 0x8B62; 1088 | DELETE_STATUS = 0x8B80; 1089 | COMPILE_STATUS = 0x8B81; 1090 | LINK_STATUS = 0x8B82; 1091 | VALIDATE_STATUS = 0x8B83; 1092 | INFO_LOG_LENGTH = 0x8B84; 1093 | ATTACHED_SHADERS = 0x8B85; 1094 | ACTIVE_UNIFORMS = 0x8B86; 1095 | ACTIVE_UNIFORM_MAX_LENGTH = 0x8B87; 1096 | SHADER_SOURCE_LENGTH = 0x8B88; 1097 | ACTIVE_ATTRIBUTES = 0x8B89; 1098 | ACTIVE_ATTRIBUTE_MAX_LENGTH = 0x8B8A; 1099 | FRAGMENT_SHADER_DERIVATIVE_HINT = 0x8B8B; 1100 | SHADING_LANGUAGE_VERSION = 0x8B8C; 1101 | CURRENT_PROGRAM = 0x8B8D; 1102 | POINT_SPRITE_COORD_ORIGIN = 0x8CA0; 1103 | LOWER_LEFT = 0x8CA1; 1104 | UPPER_LEFT = 0x8CA2; 1105 | STENCIL_BACK_REF = 0x8CA3; 1106 | STENCIL_BACK_VALUE_MASK = 0x8CA4; 1107 | STENCIL_BACK_WRITEMASK = 0x8CA5; 1108 | CURRENT_RASTER_SECONDARY_COLOR = 0x845F; 1109 | PIXEL_PACK_BUFFER = 0x88EB; 1110 | PIXEL_UNPACK_BUFFER = 0x88EC; 1111 | PIXEL_PACK_BUFFER_BINDING = 0x88ED; 1112 | PIXEL_UNPACK_BUFFER_BINDING = 0x88EF; 1113 | FLOAT_MAT2x3 = 0x8B65; 1114 | FLOAT_MAT2x4 = 0x8B66; 1115 | FLOAT_MAT3x2 = 0x8B67; 1116 | FLOAT_MAT3x4 = 0x8B68; 1117 | FLOAT_MAT4x2 = 0x8B69; 1118 | FLOAT_MAT4x3 = 0x8B6A; 1119 | SRGB = 0x8C40; 1120 | SRGB8 = 0x8C41; 1121 | SRGB_ALPHA = 0x8C42; 1122 | SRGB8_ALPHA8 = 0x8C43; 1123 | SLUMINANCE_ALPHA = 0x8C44; 1124 | SLUMINANCE8_ALPHA8 = 0x8C45; 1125 | SLUMINANCE = 0x8C46; 1126 | SLUMINANCE8 = 0x8C47; 1127 | COMPRESSED_SRGB = 0x8C48; 1128 | COMPRESSED_SRGB_ALPHA = 0x8C49; 1129 | COMPRESSED_SLUMINANCE = 0x8C4A; 1130 | COMPRESSED_SLUMINANCE_ALPHA = 0x8C4B; 1131 | CLIP_DISTANCE0 = 0x3000; 1132 | CLIP_DISTANCE1 = 0x3001; 1133 | CLIP_DISTANCE2 = 0x3002; 1134 | CLIP_DISTANCE3 = 0x3003; 1135 | CLIP_DISTANCE4 = 0x3004; 1136 | CLIP_DISTANCE5 = 0x3005; 1137 | COMPARE_REF_TO_TEXTURE = 0x884E; 1138 | MAX_CLIP_DISTANCES = 0x0D32; 1139 | MAX_VARYING_COMPONENTS = 0x8B4B; 1140 | CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT = 0x0001; 1141 | MAJOR_VERSION = 0x821B; 1142 | MINOR_VERSION = 0x821C; 1143 | NUM_EXTENSIONS = 0x821D; 1144 | CONTEXT_FLAGS = 0x821E; 1145 | DEPTH_BUFFER = 0x8223; 1146 | STENCIL_BUFFER = 0x8224; 1147 | RGBA32F = 0x8814; 1148 | RGB32F = 0x8815; 1149 | RGBA16F = 0x881A; 1150 | RGB16F = 0x881B; 1151 | VERTEX_ATTRIB_ARRAY_INTEGER = 0x88FD; 1152 | MAX_ARRAY_TEXTURE_LAYERS = 0x88FF; 1153 | MIN_PROGRAM_TEXEL_OFFSET = 0x8904; 1154 | MAX_PROGRAM_TEXEL_OFFSET = 0x8905; 1155 | CLAMP_VERTEX_COLOR = 0x891A; 1156 | CLAMP_FRAGMENT_COLOR = 0x891B; 1157 | CLAMP_READ_COLOR = 0x891C; 1158 | FIXED_ONLY = 0x891D; 1159 | TEXTURE_RED_TYPE = 0x8C10; 1160 | TEXTURE_GREEN_TYPE = 0x8C11; 1161 | TEXTURE_BLUE_TYPE = 0x8C12; 1162 | TEXTURE_ALPHA_TYPE = 0x8C13; 1163 | TEXTURE_LUMINANCE_TYPE = 0x8C14; 1164 | TEXTURE_INTENSITY_TYPE = 0x8C15; 1165 | TEXTURE_DEPTH_TYPE = 0x8C16; 1166 | TEXTURE_1D_ARRAY = 0x8C18; 1167 | PROXY_TEXTURE_1D_ARRAY = 0x8C19; 1168 | TEXTURE_2D_ARRAY = 0x8C1A; 1169 | PROXY_TEXTURE_2D_ARRAY = 0x8C1B; 1170 | TEXTURE_BINDING_1D_ARRAY = 0x8C1C; 1171 | TEXTURE_BINDING_2D_ARRAY = 0x8C1D; 1172 | R11F_G11F_B10F = 0x8C3A; 1173 | UNSIGNED_INT_10F_11F_11F_REV = 0x8C3B; 1174 | RGB9_E5 = 0x8C3D; 1175 | UNSIGNED_INT_5_9_9_9_REV = 0x8C3E; 1176 | TEXTURE_SHARED_SIZE = 0x8C3F; 1177 | TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH = 0x8C76; 1178 | TRANSFORM_FEEDBACK_BUFFER_MODE = 0x8C7F; 1179 | MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS = 0x8C80; 1180 | TRANSFORM_FEEDBACK_VARYINGS = 0x8C83; 1181 | TRANSFORM_FEEDBACK_BUFFER_START = 0x8C84; 1182 | TRANSFORM_FEEDBACK_BUFFER_SIZE = 0x8C85; 1183 | PRIMITIVES_GENERATED = 0x8C87; 1184 | TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN = 0x8C88; 1185 | RASTERIZER_DISCARD = 0x8C89; 1186 | MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS = 0x8C8A; 1187 | MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS = 0x8C8B; 1188 | INTERLEAVED_ATTRIBS = 0x8C8C; 1189 | SEPARATE_ATTRIBS = 0x8C8D; 1190 | TRANSFORM_FEEDBACK_BUFFER = 0x8C8E; 1191 | TRANSFORM_FEEDBACK_BUFFER_BINDING = 0x8C8F; 1192 | RGBA32UI = 0x8D70; 1193 | RGB32UI = 0x8D71; 1194 | RGBA16UI = 0x8D76; 1195 | RGB16UI = 0x8D77; 1196 | RGBA8UI = 0x8D7C; 1197 | RGB8UI = 0x8D7D; 1198 | RGBA32I = 0x8D82; 1199 | RGB32I = 0x8D83; 1200 | RGBA16I = 0x8D88; 1201 | RGB16I = 0x8D89; 1202 | RGBA8I = 0x8D8E; 1203 | RGB8I = 0x8D8F; 1204 | RED_INTEGER = 0x8D94; 1205 | GREEN_INTEGER = 0x8D95; 1206 | BLUE_INTEGER = 0x8D96; 1207 | ALPHA_INTEGER = 0x8D97; 1208 | RGB_INTEGER = 0x8D98; 1209 | RGBA_INTEGER = 0x8D99; 1210 | BGR_INTEGER = 0x8D9A; 1211 | BGRA_INTEGER = 0x8D9B; 1212 | SAMPLER_1D_ARRAY = 0x8DC0; 1213 | SAMPLER_2D_ARRAY = 0x8DC1; 1214 | SAMPLER_1D_ARRAY_SHADOW = 0x8DC3; 1215 | SAMPLER_2D_ARRAY_SHADOW = 0x8DC4; 1216 | SAMPLER_CUBE_SHADOW = 0x8DC5; 1217 | UNSIGNED_INT_VEC2 = 0x8DC6; 1218 | UNSIGNED_INT_VEC3 = 0x8DC7; 1219 | UNSIGNED_INT_VEC4 = 0x8DC8; 1220 | INT_SAMPLER_1D = 0x8DC9; 1221 | INT_SAMPLER_2D = 0x8DCA; 1222 | INT_SAMPLER_3D = 0x8DCB; 1223 | INT_SAMPLER_CUBE = 0x8DCC; 1224 | INT_SAMPLER_1D_ARRAY = 0x8DCE; 1225 | INT_SAMPLER_2D_ARRAY = 0x8DCF; 1226 | UNSIGNED_INT_SAMPLER_1D = 0x8DD1; 1227 | UNSIGNED_INT_SAMPLER_2D = 0x8DD2; 1228 | UNSIGNED_INT_SAMPLER_3D = 0x8DD3; 1229 | UNSIGNED_INT_SAMPLER_CUBE = 0x8DD4; 1230 | UNSIGNED_INT_SAMPLER_1D_ARRAY = 0x8DD6; 1231 | UNSIGNED_INT_SAMPLER_2D_ARRAY = 0x8DD7; 1232 | QUERY_WAIT = 0x8E13; 1233 | QUERY_NO_WAIT = 0x8E14; 1234 | QUERY_BY_REGION_WAIT = 0x8E15; 1235 | QUERY_BY_REGION_NO_WAIT = 0x8E16; 1236 | TEXTURE_RECTANGLE = 0x84F5; 1237 | TEXTURE_BINDING_RECTANGLE = 0x84F6; 1238 | PROXY_TEXTURE_RECTANGLE = 0x84F7; 1239 | MAX_RECTANGLE_TEXTURE_SIZE = 0x84F8; 1240 | SAMPLER_2D_RECT = 0x8B63; 1241 | SAMPLER_2D_RECT_SHADOW = 0x8B64; 1242 | TEXTURE_BUFFER = 0x8C2A; 1243 | MAX_TEXTURE_BUFFER_SIZE = 0x8C2B; 1244 | TEXTURE_BINDING_BUFFER = 0x8C2C; 1245 | TEXTURE_BUFFER_DATA_STORE_BINDING = 0x8C2D; 1246 | TEXTURE_BUFFER_FORMAT = 0x8C2E; 1247 | SAMPLER_BUFFER = 0x8DC2; 1248 | INT_SAMPLER_2D_RECT = 0x8DCD; 1249 | INT_SAMPLER_BUFFER = 0x8DD0; 1250 | UNSIGNED_INT_SAMPLER_2D_RECT = 0x8DD5; 1251 | UNSIGNED_INT_SAMPLER_BUFFER = 0x8DD8; 1252 | RED_SNORM = 0x8F90; 1253 | RG_SNORM = 0x8F91; 1254 | RGB_SNORM = 0x8F92; 1255 | RGBA_SNORM = 0x8F93; 1256 | R8_SNORM = 0x8F94; 1257 | RG8_SNORM = 0x8F95; 1258 | RGB8_SNORM = 0x8F96; 1259 | RGBA8_SNORM = 0x8F97; 1260 | R16_SNORM = 0x8F98; 1261 | RG16_SNORM = 0x8F99; 1262 | RGB16_SNORM = 0x8F9A; 1263 | RGBA16_SNORM = 0x8F9B; 1264 | SIGNED_NORMALIZED = 0x8F9C; 1265 | PRIMITIVE_RESTART = 0x8F9D; 1266 | PRIMITIVE_RESTART_INDEX = 0x8F9E; 1267 | BUFFER_ACCESS_FLAGS = 0x911F; 1268 | BUFFER_MAP_LENGTH = 0x9120; 1269 | BUFFER_MAP_OFFSET = 0x9121; 1270 | CONTEXT_CORE_PROFILE_BIT = 0x00000001; 1271 | CONTEXT_COMPATIBILITY_PROFILE_BIT = 0x00000002; 1272 | LINES_ADJACENCY = 0x000A; 1273 | LINE_STRIP_ADJACENCY = 0x000B; 1274 | TRIANGLES_ADJACENCY = 0x000C; 1275 | TRIANGLE_STRIP_ADJACENCY = 0x000D; 1276 | PROGRAM_POINT_SIZE = 0x8642; 1277 | GEOMETRY_VERTICES_OUT = 0x8916; 1278 | GEOMETRY_INPUT_TYPE = 0x8917; 1279 | GEOMETRY_OUTPUT_TYPE = 0x8918; 1280 | MAX_GEOMETRY_TEXTURE_IMAGE_UNITS = 0x8C29; 1281 | FRAMEBUFFER_ATTACHMENT_LAYERED = 0x8DA7; 1282 | FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS = 0x8DA8; 1283 | GEOMETRY_SHADER = 0x8DD9; 1284 | MAX_GEOMETRY_UNIFORM_COMPONENTS = 0x8DDF; 1285 | MAX_GEOMETRY_OUTPUT_VERTICES = 0x8DE0; 1286 | MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS = 0x8DE1; 1287 | MAX_VERTEX_OUTPUT_COMPONENTS = 0x9122; 1288 | MAX_GEOMETRY_INPUT_COMPONENTS = 0x9123; 1289 | MAX_GEOMETRY_OUTPUT_COMPONENTS = 0x9124; 1290 | MAX_FRAGMENT_INPUT_COMPONENTS = 0x9125; 1291 | CONTEXT_PROFILE_MASK = 0x9126; 1292 | VERTEX_ATTRIB_ARRAY_DIVISOR = 0x88FE; 1293 | RGB10_A2UI = 0x906F; 1294 | SAMPLE_SHADING = 0x8C36; 1295 | MIN_SAMPLE_SHADING_VALUE = 0x8C37; 1296 | MIN_PROGRAM_TEXTURE_GATHER_OFFSET = 0x8E5E; 1297 | MAX_PROGRAM_TEXTURE_GATHER_OFFSET = 0x8E5F; 1298 | MAX_PROGRAM_TEXTURE_GATHER_COMPONENTS = 0x8F9F; 1299 | TEXTURE_CUBE_MAP_ARRAY = 0x9009; 1300 | TEXTURE_BINDING_CUBE_MAP_ARRAY = 0x900A; 1301 | PROXY_TEXTURE_CUBE_MAP_ARRAY = 0x900B; 1302 | SAMPLER_CUBE_MAP_ARRAY = 0x900C; 1303 | SAMPLER_CUBE_MAP_ARRAY_SHADOW = 0x900D; 1304 | INT_SAMPLER_CUBE_MAP_ARRAY = 0x900E; 1305 | UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY = 0x900F; 1306 | TRANSFORM_FEEDBACK_PAUSED = 0x8E23; 1307 | TRANSFORM_FEEDBACK_ACTIVE = 0x8E24; 1308 | COMPRESSED_RGBA_BPTC_UNORM = 0x8E8C; 1309 | COMPRESSED_SRGB_ALPHA_BPTC_UNORM = 0x8E8D; 1310 | COMPRESSED_RGB_BPTC_SIGNED_FLOAT = 0x8E8E; 1311 | COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT = 0x8E8F; 1312 | COPY_READ_BUFFER_BINDING = 0x8F36; 1313 | COPY_WRITE_BUFFER_BINDING = 0x8F37; 1314 | NUM_SHADING_LANGUAGE_VERSIONS = 0x82E9; 1315 | VERTEX_ATTRIB_ARRAY_LONG = 0x874E; 1316 | PRIMITIVE_RESTART_FOR_PATCHES_SUPPORTED = 0x8221; 1317 | MAX_VERTEX_ATTRIB_STRIDE = 0x82E5; 1318 | TEXTURE_BUFFER_BINDING = 0x8C2A; 1319 | CONTEXT_FLAG_ROBUST_ACCESS_BIT = 0x00000004; 1320 | CONTEXT_FLAG_NO_ERROR_BIT = 0x00000008; 1321 | PARAMETER_BUFFER = 0x80EE; 1322 | PARAMETER_BUFFER_BINDING = 0x80EF; 1323 | TRANSFORM_FEEDBACK_OVERFLOW = 0x82EC; 1324 | TRANSFORM_FEEDBACK_STREAM_OVERFLOW = 0x82ED; 1325 | VERTICES_SUBMITTED = 0x82EE; 1326 | PRIMITIVES_SUBMITTED = 0x82EF; 1327 | VERTEX_SHADER_INVOCATIONS = 0x82F0; 1328 | TESS_CONTROL_SHADER_PATCHES = 0x82F1; 1329 | TESS_EVALUATION_SHADER_INVOCATIONS = 0x82F2; 1330 | GEOMETRY_SHADER_PRIMITIVES_EMITTED = 0x82F3; 1331 | FRAGMENT_SHADER_INVOCATIONS = 0x82F4; 1332 | COMPUTE_SHADER_INVOCATIONS = 0x82F5; 1333 | CLIPPING_INPUT_PRIMITIVES = 0x82F6; 1334 | CLIPPING_OUTPUT_PRIMITIVES = 0x82F7; 1335 | TEXTURE_MAX_ANISOTROPY = 0x84FE; 1336 | MAX_TEXTURE_MAX_ANISOTROPY = 0x84FF; 1337 | POLYGON_OFFSET_CLAMP = 0x8E1B; 1338 | SHADER_BINARY_FORMAT_SPIR_V = 0x9551; 1339 | SPIR_V_BINARY = 0x9552; 1340 | SPIR_V_EXTENSIONS = 0x9553; 1341 | NUM_SPIR_V_EXTENSIONS = 0x9554; 1342 | CONSTANT_COLOR = 0x8001; 1343 | ONE_MINUS_CONSTANT_COLOR = 0x8002; 1344 | CONSTANT_ALPHA = 0x8003; 1345 | ONE_MINUS_CONSTANT_ALPHA = 0x8004; 1346 | BLEND_COLOR = 0x8005; 1347 | FUNC_ADD = 0x8006; 1348 | MIN = 0x8007; 1349 | MAX = 0x8008; 1350 | BLEND_EQUATION = 0x8009; 1351 | FUNC_SUBTRACT = 0x800A; 1352 | FUNC_REVERSE_SUBTRACT = 0x800B; 1353 | CONVOLUTION_1D = 0x8010; 1354 | CONVOLUTION_2D = 0x8011; 1355 | SEPARABLE_2D = 0x8012; 1356 | CONVOLUTION_BORDER_MODE = 0x8013; 1357 | CONVOLUTION_FILTER_SCALE = 0x8014; 1358 | CONVOLUTION_FILTER_BIAS = 0x8015; 1359 | REDUCE = 0x8016; 1360 | CONVOLUTION_FORMAT = 0x8017; 1361 | CONVOLUTION_WIDTH = 0x8018; 1362 | CONVOLUTION_HEIGHT = 0x8019; 1363 | MAX_CONVOLUTION_WIDTH = 0x801A; 1364 | MAX_CONVOLUTION_HEIGHT = 0x801B; 1365 | POST_CONVOLUTION_RED_SCALE = 0x801C; 1366 | POST_CONVOLUTION_GREEN_SCALE = 0x801D; 1367 | POST_CONVOLUTION_BLUE_SCALE = 0x801E; 1368 | POST_CONVOLUTION_ALPHA_SCALE = 0x801F; 1369 | POST_CONVOLUTION_RED_BIAS = 0x8020; 1370 | POST_CONVOLUTION_GREEN_BIAS = 0x8021; 1371 | POST_CONVOLUTION_BLUE_BIAS = 0x8022; 1372 | POST_CONVOLUTION_ALPHA_BIAS = 0x8023; 1373 | HISTOGRAM = 0x8024; 1374 | PROXY_HISTOGRAM = 0x8025; 1375 | HISTOGRAM_WIDTH = 0x8026; 1376 | HISTOGRAM_FORMAT = 0x8027; 1377 | HISTOGRAM_RED_SIZE = 0x8028; 1378 | HISTOGRAM_GREEN_SIZE = 0x8029; 1379 | HISTOGRAM_BLUE_SIZE = 0x802A; 1380 | HISTOGRAM_ALPHA_SIZE = 0x802B; 1381 | HISTOGRAM_LUMINANCE_SIZE = 0x802C; 1382 | HISTOGRAM_SINK = 0x802D; 1383 | MINMAX = 0x802E; 1384 | MINMAX_FORMAT = 0x802F; 1385 | MINMAX_SINK = 0x8030; 1386 | TABLE_TOO_LARGE = 0x8031; 1387 | COLOR_MATRIX = 0x80B1; 1388 | COLOR_MATRIX_STACK_DEPTH = 0x80B2; 1389 | MAX_COLOR_MATRIX_STACK_DEPTH = 0x80B3; 1390 | POST_COLOR_MATRIX_RED_SCALE = 0x80B4; 1391 | POST_COLOR_MATRIX_GREEN_SCALE = 0x80B5; 1392 | POST_COLOR_MATRIX_BLUE_SCALE = 0x80B6; 1393 | POST_COLOR_MATRIX_ALPHA_SCALE = 0x80B7; 1394 | POST_COLOR_MATRIX_RED_BIAS = 0x80B8; 1395 | POST_COLOR_MATRIX_GREEN_BIAS = 0x80B9; 1396 | POST_COLOR_MATRIX_BLUE_BIAS = 0x80BA; 1397 | POST_COLOR_MATRIX_ALPHA_BIAS = 0x80BB; 1398 | COLOR_TABLE = 0x80D0; 1399 | POST_CONVOLUTION_COLOR_TABLE = 0x80D1; 1400 | POST_COLOR_MATRIX_COLOR_TABLE = 0x80D2; 1401 | PROXY_COLOR_TABLE = 0x80D3; 1402 | PROXY_POST_CONVOLUTION_COLOR_TABLE = 0x80D4; 1403 | PROXY_POST_COLOR_MATRIX_COLOR_TABLE = 0x80D5; 1404 | COLOR_TABLE_SCALE = 0x80D6; 1405 | COLOR_TABLE_BIAS = 0x80D7; 1406 | COLOR_TABLE_FORMAT = 0x80D8; 1407 | COLOR_TABLE_WIDTH = 0x80D9; 1408 | COLOR_TABLE_RED_SIZE = 0x80DA; 1409 | COLOR_TABLE_GREEN_SIZE = 0x80DB; 1410 | COLOR_TABLE_BLUE_SIZE = 0x80DC; 1411 | COLOR_TABLE_ALPHA_SIZE = 0x80DD; 1412 | COLOR_TABLE_LUMINANCE_SIZE = 0x80DE; 1413 | COLOR_TABLE_INTENSITY_SIZE = 0x80DF; 1414 | IGNORE_BORDER = 0x8150; 1415 | CONSTANT_BORDER = 0x8151; 1416 | WRAP_BORDER = 0x8152; 1417 | REPLICATE_BORDER = 0x8153; 1418 | CONVOLUTION_BORDER_COLOR = 0x8154; 1419 | CONTEXT_FLAG_DEBUG_BIT = 0x00000002; 1420 | DEBUG_OUTPUT_SYNCHRONOUS = 0x8242; 1421 | DEBUG_NEXT_LOGGED_MESSAGE_LENGTH = 0x8243; 1422 | DEBUG_CALLBACK_FUNCTION = 0x8244; 1423 | DEBUG_CALLBACK_USER_PARAM = 0x8245; 1424 | DEBUG_SOURCE_API = 0x8246; 1425 | DEBUG_SOURCE_WINDOW_SYSTEM = 0x8247; 1426 | DEBUG_SOURCE_SHADER_COMPILER = 0x8248; 1427 | DEBUG_SOURCE_THIRD_PARTY = 0x8249; 1428 | DEBUG_SOURCE_APPLICATION = 0x824A; 1429 | DEBUG_SOURCE_OTHER = 0x824B; 1430 | DEBUG_TYPE_ERROR = 0x824C; 1431 | DEBUG_TYPE_DEPRECATED_BEHAVIOR = 0x824D; 1432 | DEBUG_TYPE_UNDEFINED_BEHAVIOR = 0x824E; 1433 | DEBUG_TYPE_PORTABILITY = 0x824F; 1434 | DEBUG_TYPE_PERFORMANCE = 0x8250; 1435 | DEBUG_TYPE_OTHER = 0x8251; 1436 | DEBUG_TYPE_MARKER = 0x8268; 1437 | DEBUG_TYPE_PUSH_GROUP = 0x8269; 1438 | DEBUG_TYPE_POP_GROUP = 0x826A; 1439 | DEBUG_SEVERITY_NOTIFICATION = 0x826B; 1440 | MAX_DEBUG_GROUP_STACK_DEPTH = 0x826C; 1441 | DEBUG_GROUP_STACK_DEPTH = 0x826D; 1442 | BUFFER = 0x82E0; 1443 | SHADER = 0x82E1; 1444 | PROGRAM = 0x82E2; 1445 | QUERY = 0x82E3; 1446 | PROGRAM_PIPELINE = 0x82E4; 1447 | SAMPLER = 0x82E6; 1448 | DISPLAY_LIST = 0x82E7; 1449 | MAX_LABEL_LENGTH = 0x82E8; 1450 | MAX_DEBUG_MESSAGE_LENGTH = 0x9143; 1451 | MAX_DEBUG_LOGGED_MESSAGES = 0x9144; 1452 | DEBUG_LOGGED_MESSAGES = 0x9145; 1453 | DEBUG_SEVERITY_HIGH = 0x9146; 1454 | DEBUG_SEVERITY_MEDIUM = 0x9147; 1455 | DEBUG_SEVERITY_LOW = 0x9148; 1456 | DEBUG_OUTPUT = 0x92E0; 1457 | TEXTURE_COMPARE_MODE_ARB = 0x884C; 1458 | TEXTURE_COMPARE_FUNC_ARB = 0x884D; 1459 | COMPARE_R_TO_TEXTURE_ARB = 0x884E; 1460 | SYNC_FLUSH_COMMANDS_BIT = 0x00000001; 1461 | MAX_SERVER_WAIT_TIMEOUT = 0x9111; 1462 | OBJECT_TYPE = 0x9112; 1463 | SYNC_CONDITION = 0x9113; 1464 | SYNC_STATUS = 0x9114; 1465 | SYNC_FLAGS = 0x9115; 1466 | SYNC_FENCE = 0x9116; 1467 | SYNC_GPU_COMMANDS_COMPLETE = 0x9117; 1468 | UNSIGNALED = 0x9118; 1469 | SIGNALED = 0x9119; 1470 | ALREADY_SIGNALED = 0x911A; 1471 | TIMEOUT_EXPIRED = 0x911B; 1472 | CONDITION_SATISFIED = 0x911C; 1473 | WAIT_FAILED = 0x911D; 1474 | TIMEOUT_IGNORED = 0xFFFFFFFFFFFFFFFFn; 1475 | COMPRESSED_RED = 0x8225; 1476 | COMPRESSED_RG = 0x8226; 1477 | RG = 0x8227; 1478 | RG_INTEGER = 0x8228; 1479 | R8 = 0x8229; 1480 | R16 = 0x822A; 1481 | RG8 = 0x822B; 1482 | RG16 = 0x822C; 1483 | R16F = 0x822D; 1484 | R32F = 0x822E; 1485 | RG16F = 0x822F; 1486 | RG32F = 0x8230; 1487 | R8I = 0x8231; 1488 | R8UI = 0x8232; 1489 | R16I = 0x8233; 1490 | R16UI = 0x8234; 1491 | R32I = 0x8235; 1492 | R32UI = 0x8236; 1493 | RG8I = 0x8237; 1494 | RG8UI = 0x8238; 1495 | RG16I = 0x8239; 1496 | RG16UI = 0x823A; 1497 | RG32I = 0x823B; 1498 | RG32UI = 0x823C; 1499 | HALF_FLOAT = 0x140B; 1500 | INVALID_FRAMEBUFFER_OPERATION = 0x0506; 1501 | FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING = 0x8210; 1502 | FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE = 0x8211; 1503 | FRAMEBUFFER_ATTACHMENT_RED_SIZE = 0x8212; 1504 | FRAMEBUFFER_ATTACHMENT_GREEN_SIZE = 0x8213; 1505 | FRAMEBUFFER_ATTACHMENT_BLUE_SIZE = 0x8214; 1506 | FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE = 0x8215; 1507 | FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE = 0x8216; 1508 | FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE = 0x8217; 1509 | FRAMEBUFFER_DEFAULT = 0x8218; 1510 | FRAMEBUFFER_UNDEFINED = 0x8219; 1511 | DEPTH_STENCIL_ATTACHMENT = 0x821A; 1512 | INDEX = 0x8222; 1513 | MAX_RENDERBUFFER_SIZE = 0x84E8; 1514 | DEPTH_STENCIL = 0x84F9; 1515 | UNSIGNED_INT_24_8 = 0x84FA; 1516 | DEPTH24_STENCIL8 = 0x88F0; 1517 | TEXTURE_STENCIL_SIZE = 0x88F1; 1518 | UNSIGNED_NORMALIZED = 0x8C17; 1519 | DRAW_FRAMEBUFFER_BINDING = 0x8CA6; 1520 | FRAMEBUFFER_BINDING = 0x8CA6; 1521 | RENDERBUFFER_BINDING = 0x8CA7; 1522 | READ_FRAMEBUFFER = 0x8CA8; 1523 | DRAW_FRAMEBUFFER = 0x8CA9; 1524 | READ_FRAMEBUFFER_BINDING = 0x8CAA; 1525 | RENDERBUFFER_SAMPLES = 0x8CAB; 1526 | FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE = 0x8CD0; 1527 | FRAMEBUFFER_ATTACHMENT_OBJECT_NAME = 0x8CD1; 1528 | FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL = 0x8CD2; 1529 | FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE = 0x8CD3; 1530 | FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER = 0x8CD4; 1531 | FRAMEBUFFER_COMPLETE = 0x8CD5; 1532 | FRAMEBUFFER_INCOMPLETE_ATTACHMENT = 0x8CD6; 1533 | FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT = 0x8CD7; 1534 | FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER = 0x8CDB; 1535 | FRAMEBUFFER_INCOMPLETE_READ_BUFFER = 0x8CDC; 1536 | FRAMEBUFFER_UNSUPPORTED = 0x8CDD; 1537 | MAX_COLOR_ATTACHMENTS = 0x8CDF; 1538 | COLOR_ATTACHMENT0 = 0x8CE0; 1539 | COLOR_ATTACHMENT1 = 0x8CE1; 1540 | COLOR_ATTACHMENT2 = 0x8CE2; 1541 | COLOR_ATTACHMENT3 = 0x8CE3; 1542 | COLOR_ATTACHMENT4 = 0x8CE4; 1543 | COLOR_ATTACHMENT5 = 0x8CE5; 1544 | COLOR_ATTACHMENT6 = 0x8CE6; 1545 | COLOR_ATTACHMENT7 = 0x8CE7; 1546 | COLOR_ATTACHMENT8 = 0x8CE8; 1547 | COLOR_ATTACHMENT9 = 0x8CE9; 1548 | COLOR_ATTACHMENT10 = 0x8CEA; 1549 | COLOR_ATTACHMENT11 = 0x8CEB; 1550 | COLOR_ATTACHMENT12 = 0x8CEC; 1551 | COLOR_ATTACHMENT13 = 0x8CED; 1552 | COLOR_ATTACHMENT14 = 0x8CEE; 1553 | COLOR_ATTACHMENT15 = 0x8CEF; 1554 | DEPTH_ATTACHMENT = 0x8D00; 1555 | STENCIL_ATTACHMENT = 0x8D20; 1556 | FRAMEBUFFER = 0x8D40; 1557 | RENDERBUFFER = 0x8D41; 1558 | RENDERBUFFER_WIDTH = 0x8D42; 1559 | RENDERBUFFER_HEIGHT = 0x8D43; 1560 | RENDERBUFFER_INTERNAL_FORMAT = 0x8D44; 1561 | STENCIL_INDEX1 = 0x8D46; 1562 | STENCIL_INDEX4 = 0x8D47; 1563 | STENCIL_INDEX8 = 0x8D48; 1564 | STENCIL_INDEX16 = 0x8D49; 1565 | RENDERBUFFER_RED_SIZE = 0x8D50; 1566 | RENDERBUFFER_GREEN_SIZE = 0x8D51; 1567 | RENDERBUFFER_BLUE_SIZE = 0x8D52; 1568 | RENDERBUFFER_ALPHA_SIZE = 0x8D53; 1569 | RENDERBUFFER_DEPTH_SIZE = 0x8D54; 1570 | RENDERBUFFER_STENCIL_SIZE = 0x8D55; 1571 | FRAMEBUFFER_INCOMPLETE_MULTISAMPLE = 0x8D56; 1572 | MAX_SAMPLES = 0x8D57; 1573 | FIXED = 0x140C; 1574 | IMPLEMENTATION_COLOR_READ_TYPE = 0x8B9A; 1575 | IMPLEMENTATION_COLOR_READ_FORMAT = 0x8B9B; 1576 | RGB565 = 0x8D62; 1577 | LOW_FLOAT = 0x8DF0; 1578 | MEDIUM_FLOAT = 0x8DF1; 1579 | HIGH_FLOAT = 0x8DF2; 1580 | LOW_INT = 0x8DF3; 1581 | MEDIUM_INT = 0x8DF4; 1582 | HIGH_INT = 0x8DF5; 1583 | SHADER_BINARY_FORMATS = 0x8DF8; 1584 | NUM_SHADER_BINARY_FORMATS = 0x8DF9; 1585 | SHADER_COMPILER = 0x8DFA; 1586 | MAX_VERTEX_UNIFORM_VECTORS = 0x8DFB; 1587 | MAX_VARYING_VECTORS = 0x8DFC; 1588 | MAX_FRAGMENT_UNIFORM_VECTORS = 0x8DFD; 1589 | UNPACK_FLIP_Y_WEBGL = 37440; 1590 | UNPACK_PREMULTIPLY_ALPHA_WEBGL = 37441; 1591 | UNPACK_COLORSPACE_CONVERSION_WEBGL = 37443; 1592 | } 1593 | -------------------------------------------------------------------------------- /src/core/glfw.ts: -------------------------------------------------------------------------------- 1 | import { cstr, MapFFI, OS_LIB_PREFIX, OS_LIB_SUFFIX } from "./util.ts"; 2 | import { init } from "./opengl.ts"; 3 | import { GLFW_CONST } from "./const.ts"; 4 | 5 | export const symbols = { 6 | initHint: { 7 | parameters: ["i32", "i32"], 8 | result: "void", 9 | }, 10 | 11 | init: { 12 | parameters: [], 13 | result: "i32", 14 | }, 15 | 16 | getVersion: { 17 | parameters: ["pointer", "pointer", "pointer"], 18 | result: "void", 19 | }, 20 | 21 | getVersionString: { 22 | parameters: [], 23 | result: "pointer", 24 | }, 25 | 26 | getError: { 27 | parameters: ["pointer"], 28 | result: "i32", 29 | }, 30 | 31 | setErrorCallback: { 32 | parameters: ["pointer"], 33 | result: "pointer", 34 | }, 35 | 36 | terminate: { 37 | parameters: [], 38 | result: "void", 39 | }, 40 | 41 | windowHint: { 42 | parameters: ["i32", "i32"], 43 | result: "void", 44 | }, 45 | 46 | createWindow: { 47 | parameters: [ 48 | "i32", 49 | "i32", 50 | "pointer", 51 | "pointer", 52 | "pointer", 53 | ], 54 | result: "pointer", 55 | }, 56 | 57 | makeContextCurrent: { 58 | parameters: ["pointer"], 59 | result: "void", 60 | }, 61 | 62 | setInputMode: { 63 | parameters: ["pointer", "i32", "i32"], 64 | result: "void", 65 | }, 66 | 67 | swapBuffers: { 68 | parameters: ["pointer"], 69 | result: "void", 70 | }, 71 | 72 | pollEvents: { 73 | parameters: [], 74 | result: "void", 75 | }, 76 | 77 | windowShouldClose: { 78 | parameters: ["pointer"], 79 | result: "i32", 80 | }, 81 | 82 | getProcAddress: { 83 | parameters: ["pointer"], 84 | result: "pointer", 85 | }, 86 | 87 | defaultWindowHints: { 88 | parameters: [], 89 | result: "void", 90 | }, 91 | 92 | windowHintString: { 93 | parameters: ["i32", "pointer"], 94 | result: "void", 95 | }, 96 | 97 | setWindowShouldClose: { 98 | parameters: ["pointer", "i32"], 99 | result: "void", 100 | }, 101 | 102 | setWindowTitle: { 103 | parameters: ["pointer", "pointer"], 104 | result: "void", 105 | }, 106 | 107 | setWindowIcon: { 108 | parameters: ["pointer", "i32", "pointer"], 109 | result: "void", 110 | }, 111 | 112 | getWindowPos: { 113 | parameters: ["pointer", "pointer", "pointer"], 114 | result: "void", 115 | }, 116 | 117 | setWindowPos: { 118 | parameters: ["pointer", "i32", "i32"], 119 | result: "void", 120 | }, 121 | 122 | getWindowSize: { 123 | parameters: ["pointer", "pointer", "pointer"], 124 | result: "void", 125 | }, 126 | 127 | setWindowSizeLimits: { 128 | parameters: ["pointer", "i32", "i32", "i32", "i32"], 129 | result: "void", 130 | }, 131 | 132 | setWindowAspectRatio: { 133 | parameters: ["pointer", "i32", "i32"], 134 | result: "void", 135 | }, 136 | 137 | setWindowSize: { 138 | parameters: ["pointer", "i32", "i32"], 139 | result: "void", 140 | }, 141 | 142 | getFramebufferSize: { 143 | parameters: ["pointer", "pointer", "pointer"], 144 | result: "void", 145 | }, 146 | 147 | getWindowFrameSize: { 148 | parameters: ["pointer", "pointer", "pointer", "pointer"], 149 | result: "void", 150 | }, 151 | 152 | getWindowContentScale: { 153 | parameters: ["pointer", "pointer", "pointer"], 154 | result: "void", 155 | }, 156 | 157 | getWindowOpacity: { 158 | parameters: ["pointer"], 159 | result: "f32", 160 | }, 161 | 162 | setWindowOpacity: { 163 | parameters: ["pointer", "f32"], 164 | result: "void", 165 | }, 166 | 167 | iconifyWindow: { 168 | parameters: ["pointer"], 169 | result: "void", 170 | }, 171 | 172 | restoreWindow: { 173 | parameters: ["pointer"], 174 | result: "void", 175 | }, 176 | 177 | maximizeWindow: { 178 | parameters: ["pointer"], 179 | result: "void", 180 | }, 181 | 182 | showWindow: { 183 | parameters: ["pointer"], 184 | result: "void", 185 | }, 186 | 187 | hideWindow: { 188 | parameters: ["pointer"], 189 | result: "void", 190 | }, 191 | 192 | focusWindow: { 193 | parameters: ["pointer"], 194 | result: "void", 195 | }, 196 | 197 | requestWindowAttention: { 198 | parameters: ["pointer"], 199 | result: "void", 200 | }, 201 | 202 | getWindowMonitor: { 203 | parameters: ["pointer"], 204 | result: "pointer", 205 | }, 206 | 207 | setWindowMonitor: { 208 | parameters: ["pointer", "pointer", "i32", "i32", "i32", "i32", "i32"], 209 | result: "void", 210 | }, 211 | 212 | getWindowAttrib: { 213 | parameters: ["pointer", "i32"], 214 | result: "i32", 215 | }, 216 | 217 | setWindowAttrib: { 218 | parameters: ["pointer", "i32", "i32"], 219 | result: "void", 220 | }, 221 | 222 | setWindowUserPointer: { 223 | parameters: ["pointer", "pointer"], 224 | result: "void", 225 | }, 226 | 227 | getWindowUserPointer: { 228 | parameters: ["pointer"], 229 | result: "pointer", 230 | }, 231 | 232 | // TODO: callbacks 233 | 234 | setWindowPosCallback: { 235 | parameters: ["pointer", "pointer"], 236 | result: "pointer", 237 | }, 238 | 239 | setWindowSizeCallback: { 240 | parameters: ["pointer", "pointer"], 241 | result: "pointer", 242 | }, 243 | 244 | setWindowCloseCallback: { 245 | parameters: ["pointer", "pointer"], 246 | result: "pointer", 247 | }, 248 | 249 | setWindowRefreshCallback: { 250 | parameters: ["pointer", "pointer"], 251 | result: "pointer", 252 | }, 253 | 254 | setWindowFocusCallback: { 255 | parameters: ["pointer", "pointer"], 256 | result: "pointer", 257 | }, 258 | 259 | setWindowIconifyCallback: { 260 | parameters: ["pointer", "pointer"], 261 | result: "pointer", 262 | }, 263 | 264 | setWindowMaximizeCallback: { 265 | parameters: ["pointer", "pointer"], 266 | result: "pointer", 267 | }, 268 | 269 | setFramebufferSizeCallback: { 270 | parameters: ["pointer", "pointer"], 271 | result: "pointer", 272 | }, 273 | 274 | setWindowContentScaleCallback: { 275 | parameters: ["pointer", "pointer"], 276 | result: "pointer", 277 | }, 278 | 279 | waitEvents: { 280 | parameters: [], 281 | result: "void", 282 | }, 283 | 284 | waitEventsTimeout: { 285 | parameters: ["f64"], 286 | result: "void", 287 | }, 288 | 289 | postEmptyEvent: { 290 | parameters: [], 291 | result: "void", 292 | }, 293 | 294 | getMonitors: { 295 | parameters: ["pointer"], 296 | result: "pointer", 297 | }, 298 | 299 | getPrimaryMonitor: { 300 | parameters: [], 301 | result: "pointer", 302 | }, 303 | 304 | getMonitorPos: { 305 | parameters: ["pointer", "pointer", "pointer"], 306 | result: "void", 307 | }, 308 | 309 | getMonitorWorkarea: { 310 | parameters: ["pointer", "pointer", "pointer", "pointer", "pointer"], 311 | result: "void", 312 | }, 313 | 314 | getMonitorPhysicalSize: { 315 | parameters: ["pointer", "pointer", "pointer"], 316 | result: "void", 317 | }, 318 | 319 | getMonitorContentScale: { 320 | parameters: ["pointer", "pointer", "pointer"], 321 | result: "void", 322 | }, 323 | 324 | getMonitorName: { 325 | parameters: ["pointer"], 326 | result: "pointer", 327 | }, 328 | 329 | setMonitorUserPointer: { 330 | parameters: ["pointer", "pointer"], 331 | result: "void", 332 | }, 333 | 334 | getMonitorUserPointer: { 335 | parameters: ["pointer"], 336 | result: "pointer", 337 | }, 338 | 339 | setMonitorCallback: { 340 | parameters: ["pointer"], 341 | result: "pointer", 342 | }, 343 | 344 | getVideoModes: { 345 | parameters: ["pointer", "pointer"], 346 | result: "pointer", 347 | }, 348 | 349 | getVideoMode: { 350 | parameters: ["pointer"], 351 | result: "pointer", 352 | }, 353 | 354 | setGamma: { 355 | parameters: ["pointer", "f32"], 356 | result: "void", 357 | }, 358 | 359 | getGammaRamp: { 360 | parameters: ["pointer"], 361 | result: "pointer", 362 | }, 363 | 364 | setGammaRamp: { 365 | parameters: ["pointer", "pointer"], 366 | result: "void", 367 | }, 368 | 369 | extensionSupported: { 370 | parameters: ["pointer"], 371 | result: "i32", 372 | }, 373 | 374 | swapInterval: { 375 | parameters: ["i32"], 376 | result: "void", 377 | }, 378 | 379 | getCurrentContext: { 380 | parameters: [], 381 | result: "pointer", 382 | }, 383 | 384 | getInputMode: { 385 | parameters: ["pointer", "i32"], 386 | result: "i32", 387 | }, 388 | 389 | rawMouseMotionSupported: { 390 | parameters: [], 391 | result: "i32", 392 | }, 393 | 394 | getKeyName: { 395 | parameters: ["i32", "i32"], 396 | result: "pointer", 397 | }, 398 | 399 | getKeyScancode: { 400 | parameters: ["i32"], 401 | result: "i32", 402 | }, 403 | 404 | getKey: { 405 | parameters: ["pointer", "i32"], 406 | result: "i32", 407 | }, 408 | 409 | getMouseButton: { 410 | parameters: ["pointer", "i32"], 411 | result: "i32", 412 | }, 413 | 414 | getCursorPos: { 415 | parameters: ["pointer", "pointer", "pointer"], 416 | result: "void", 417 | }, 418 | 419 | setCursorPos: { 420 | parameters: ["pointer", "f64", "f64"], 421 | result: "void", 422 | }, 423 | 424 | createCursor: { 425 | parameters: ["pointer", "i32", "i32"], 426 | result: "pointer", 427 | }, 428 | 429 | createStandardCursor: { 430 | parameters: ["i32"], 431 | result: "pointer", 432 | }, 433 | 434 | destroyCursor: { 435 | parameters: ["pointer"], 436 | result: "void", 437 | }, 438 | 439 | setCursor: { 440 | parameters: ["pointer", "pointer"], 441 | result: "void", 442 | }, 443 | 444 | setKeyCallback: { 445 | parameters: ["pointer", "pointer"], 446 | result: "pointer", 447 | }, 448 | 449 | setCharCallback: { 450 | parameters: ["pointer", "pointer"], 451 | result: "pointer", 452 | }, 453 | 454 | setCharModsCallback: { 455 | parameters: ["pointer", "pointer"], 456 | result: "pointer", 457 | }, 458 | 459 | setMouseButtonCallback: { 460 | parameters: ["pointer", "pointer"], 461 | result: "pointer", 462 | }, 463 | 464 | setCursorPosCallback: { 465 | parameters: ["pointer", "pointer"], 466 | result: "pointer", 467 | }, 468 | 469 | setCursorEnterCallback: { 470 | parameters: ["pointer", "pointer"], 471 | result: "pointer", 472 | }, 473 | 474 | setScrollCallback: { 475 | parameters: ["pointer", "pointer"], 476 | result: "pointer", 477 | }, 478 | 479 | setDropCallback: { 480 | parameters: ["pointer", "pointer"], 481 | result: "pointer", 482 | }, 483 | 484 | joystickPresent: { 485 | parameters: ["i32"], 486 | result: "i32", 487 | }, 488 | 489 | getJoystickAxes: { 490 | parameters: ["i32", "pointer"], 491 | result: "pointer", 492 | }, 493 | 494 | getJoystickButtons: { 495 | parameters: ["i32", "pointer"], 496 | result: "pointer", 497 | }, 498 | 499 | getJoystickHats: { 500 | parameters: ["i32", "pointer"], 501 | result: "pointer", 502 | }, 503 | 504 | getJoystickName: { 505 | parameters: ["i32"], 506 | result: "pointer", 507 | }, 508 | 509 | getJoystickGUID: { 510 | parameters: ["i32"], 511 | result: "pointer", 512 | }, 513 | 514 | setJoystickUserPointer: { 515 | parameters: ["i32", "pointer"], 516 | result: "void", 517 | }, 518 | 519 | getJoystickUserPointer: { 520 | parameters: ["i32"], 521 | result: "pointer", 522 | }, 523 | 524 | joystickIsGamepad: { 525 | parameters: ["i32"], 526 | result: "i32", 527 | }, 528 | 529 | setJoystickCallback: { 530 | parameters: ["pointer"], 531 | result: "pointer", 532 | }, 533 | 534 | updateGamepadMappings: { 535 | parameters: ["pointer"], 536 | result: "i32", 537 | }, 538 | 539 | getGamepadName: { 540 | parameters: ["i32"], 541 | result: "pointer", 542 | }, 543 | 544 | getGamepadState: { 545 | parameters: ["i32", "pointer"], 546 | result: "i32", 547 | }, 548 | 549 | setClipboardString: { 550 | parameters: ["pointer", "pointer"], 551 | result: "void", 552 | }, 553 | 554 | getClipboardString: { 555 | parameters: ["pointer"], 556 | result: "pointer", 557 | }, 558 | 559 | getTime: { 560 | parameters: [], 561 | result: "f64", 562 | }, 563 | 564 | setTime: { 565 | parameters: ["f64"], 566 | result: "void", 567 | }, 568 | 569 | getTimerValue: { 570 | parameters: [], 571 | result: "i64", 572 | }, 573 | 574 | getTimerFrequency: { 575 | parameters: [], 576 | result: "i64", 577 | }, 578 | 579 | destroyWindow: { 580 | parameters: ["pointer"], 581 | result: "void", 582 | }, 583 | } as const; 584 | 585 | export type Symbols = { 586 | [K in keyof typeof symbols]: { 587 | // Make non-readonly 588 | parameters: [...(typeof symbols)[K]["parameters"]]; 589 | result: (typeof symbols)[K]["result"]; 590 | }; 591 | }; 592 | 593 | export const LIB_PATH = new URL( 594 | `../../dist/${OS_LIB_PREFIX}glfw3.${OS_LIB_SUFFIX}`, 595 | import.meta.url, 596 | ); 597 | 598 | function prefixGlfw(name: string) { 599 | return `glfw${name[0].toUpperCase()}${name.slice(1)}`; 600 | } 601 | 602 | export const lib = Deno.dlopen( 603 | LIB_PATH, 604 | Object.fromEntries( 605 | Object.entries(symbols).map(([name, def]) => { 606 | return [prefixGlfw(name), def]; 607 | }), 608 | ) as unknown as Record< 609 | string, 610 | Deno.ForeignFunction 611 | >, 612 | ); 613 | 614 | export function initGL() { 615 | init((name) => 616 | lib.symbols.glfwGetProcAddress(cstr(name)) as Deno.UnsafePointer 617 | ); 618 | } 619 | 620 | const glfw = Object.assign( 621 | Object.fromEntries( 622 | Object.keys(symbols).map(( 623 | name, 624 | ) => [ 625 | name, 626 | lib.symbols[prefixGlfw(name)], 627 | ]), 628 | ), 629 | new GLFW_CONST(), 630 | ) as unknown as 631 | & MapFFI 632 | & GLFW_CONST; 633 | 634 | export default glfw; 635 | -------------------------------------------------------------------------------- /src/core/mod.ts: -------------------------------------------------------------------------------- 1 | export { default as gl } from "./opengl.ts"; 2 | export { default as glfw, initGL } from "./glfw.ts"; 3 | export * from "./util.ts"; 4 | export * from "./const.ts"; 5 | -------------------------------------------------------------------------------- /src/core/opengl.ts: -------------------------------------------------------------------------------- 1 | import { GL_CONST } from "./const.ts"; 2 | import { MapFFI } from "./util.ts"; 3 | 4 | const GLenum = "u32" as const; 5 | const GLboolean = "u8" as const; 6 | const GLbitfield = "u32" as const; 7 | // const GLbyte = "i8" as const; 8 | // const GLshort = "i16" as const; 9 | const GLint = "i32" as const; 10 | const GLsizei = "i32" as const; 11 | const GLintptr = "u64" as const; 12 | const GLsizeiptr = "u64" as const; 13 | // const GLubyte = "u8" as const; 14 | // const GLushort = "u16" as const; 15 | const GLuint = "u32" as const; 16 | const GLuint64 = "u64" as const; 17 | const GLfloat = "f32" as const; 18 | const GLclampf = "f32" as const; 19 | const GLfloatv = "pointer" as const; 20 | const GLbooleanv = "pointer" as const; 21 | const GLubyteptr = "pointer" as const; 22 | const GLvoidptr = "pointer" as const; 23 | const GLuintv = "pointer" as const; 24 | const GLintv = "pointer" as const; 25 | const GLcharptr = "pointer" as const; 26 | const GLenumv = "pointer" as const; 27 | const GLint64v = "pointer" as const; 28 | 29 | export const symbols = { 30 | /// 5.14.3 Setting and getting state 31 | 32 | activeTexture: { 33 | parameters: [GLenum], 34 | result: "void", 35 | }, 36 | 37 | blendColor: { 38 | parameters: [GLclampf, GLclampf, GLclampf, GLclampf], 39 | result: "void", 40 | }, 41 | 42 | blendEquation: { 43 | parameters: [GLenum], 44 | result: "void", 45 | }, 46 | 47 | blendEquationSeparate: { 48 | parameters: [GLenum, GLenum], 49 | result: "void", 50 | }, 51 | 52 | blendFunc: { 53 | parameters: [GLenum, GLenum], 54 | result: "void", 55 | }, 56 | 57 | blendFuncSeparate: { 58 | parameters: [GLenum, GLenum, GLenum, GLenum], 59 | result: "void", 60 | }, 61 | 62 | clearColor: { 63 | parameters: [GLclampf, GLclampf, GLclampf, GLclampf], 64 | result: "void", 65 | }, 66 | 67 | clearDepthf: { 68 | parameters: [GLclampf], 69 | result: "void", 70 | }, 71 | 72 | clearStencil: { 73 | parameters: [GLint], 74 | result: "void", 75 | }, 76 | 77 | colorMask: { 78 | parameters: [GLboolean, GLboolean, GLboolean, GLboolean], 79 | result: "void", 80 | }, 81 | 82 | cullFace: { 83 | parameters: [GLenum], 84 | result: "void", 85 | }, 86 | 87 | depthFunc: { 88 | parameters: [GLenum], 89 | result: "void", 90 | }, 91 | 92 | depthMask: { 93 | parameters: [GLboolean], 94 | result: "void", 95 | }, 96 | 97 | depthRangef: { 98 | parameters: [GLclampf, GLclampf], 99 | result: "void", 100 | }, 101 | 102 | disable: { 103 | parameters: [GLenum], 104 | result: "void", 105 | }, 106 | 107 | enable: { 108 | parameters: [GLenum], 109 | result: "void", 110 | }, 111 | 112 | frontFace: { 113 | parameters: [GLenum], 114 | result: "void", 115 | }, 116 | 117 | getIntegerv: { 118 | parameters: [GLenum, GLintv], 119 | result: "void", 120 | }, 121 | 122 | getFloatv: { 123 | parameters: [GLenum, GLfloatv], 124 | result: "void", 125 | }, 126 | 127 | getBooleanv: { 128 | parameters: [GLenum, GLbooleanv], 129 | result: "void", 130 | }, 131 | 132 | getString: { 133 | parameters: [GLenum], 134 | result: GLubyteptr, 135 | }, 136 | 137 | getError: { 138 | parameters: [], 139 | result: GLenum, 140 | }, 141 | 142 | debugMessageCallback: { 143 | parameters: ["pointer"], 144 | result: "void", 145 | }, 146 | 147 | hint: { 148 | parameters: [GLenum, GLenum], 149 | result: "void", 150 | }, 151 | 152 | isEnabled: { 153 | parameters: [GLenum], 154 | result: GLboolean, 155 | }, 156 | 157 | lineWidth: { 158 | parameters: [GLfloat], 159 | result: "void", 160 | }, 161 | 162 | pixelStorei: { 163 | parameters: [GLenum, GLint], 164 | result: "void", 165 | }, 166 | 167 | polygonOffset: { 168 | parameters: [GLfloat, GLfloat], 169 | result: "void", 170 | }, 171 | 172 | sampleCoverage: { 173 | parameters: [GLclampf, GLboolean], 174 | result: "void", 175 | }, 176 | 177 | stencilFunc: { 178 | parameters: [GLenum, GLint, GLuint], 179 | result: "void", 180 | }, 181 | 182 | stencilFuncSeparate: { 183 | parameters: [GLenum, GLenum, GLint, GLuint], 184 | result: "void", 185 | }, 186 | 187 | stencilMask: { 188 | parameters: [GLuint], 189 | result: "void", 190 | }, 191 | 192 | stencilMaskSeparate: { 193 | parameters: [GLenum, GLuint], 194 | result: "void", 195 | }, 196 | 197 | stencilOp: { 198 | parameters: [GLenum, GLenum, GLenum], 199 | result: "void", 200 | }, 201 | 202 | stencilOpSeparate: { 203 | parameters: [GLenum, GLenum, GLenum, GLenum], 204 | result: "void", 205 | }, 206 | 207 | /// 5.14.4 Viewing and clipping 208 | 209 | scissor: { 210 | parameters: [GLint, GLint, GLsizei, GLsizei], 211 | result: "void", 212 | }, 213 | 214 | viewport: { 215 | parameters: [GLint, GLint, GLsizei, GLsizei], 216 | result: "void", 217 | }, 218 | 219 | /// 5.14.5 Buffer objects 220 | 221 | bindBuffer: { 222 | parameters: [GLenum, GLuint], 223 | result: "void", 224 | }, 225 | 226 | bufferData: { 227 | parameters: [GLenum, GLsizeiptr, GLvoidptr, GLenum], 228 | result: "void", 229 | }, 230 | 231 | bufferSubData: { 232 | parameters: [GLenum, GLintptr, GLsizeiptr, GLvoidptr], 233 | result: "void", 234 | }, 235 | 236 | genBuffers: { 237 | parameters: [GLsizei, GLuintv], 238 | result: "void", 239 | }, 240 | 241 | deleteBuffers: { 242 | parameters: [GLsizei, GLuintv], 243 | result: "void", 244 | }, 245 | 246 | getBufferParameteriv: { 247 | parameters: [GLenum, GLenum, GLintv], 248 | result: "void", 249 | }, 250 | 251 | isBuffer: { 252 | parameters: [GLuint], 253 | result: GLboolean, 254 | }, 255 | 256 | /// 5.14.6 Framebuffer objects 257 | 258 | bindFramebuffer: { 259 | parameters: [GLenum, GLuint], 260 | result: "void", 261 | }, 262 | 263 | checkFramebufferStatus: { 264 | parameters: [GLenum], 265 | result: GLenum, 266 | }, 267 | 268 | genFramebuffers: { 269 | parameters: [GLsizei, GLuintv], 270 | result: "void", 271 | }, 272 | 273 | deleteFramebuffers: { 274 | parameters: [GLsizei, GLuintv], 275 | result: "void", 276 | }, 277 | 278 | framebufferRenderbuffer: { 279 | parameters: [GLenum, GLenum, GLenum, GLuint], 280 | result: "void", 281 | }, 282 | 283 | framebufferTexture2D: { 284 | parameters: [GLenum, GLenum, GLenum, GLuint, GLint], 285 | result: "void", 286 | }, 287 | 288 | getFramebufferAttachmentParameteriv: { 289 | parameters: [GLenum, GLenum, GLenum, GLintv], 290 | result: "void", 291 | }, 292 | 293 | isFramebuffer: { 294 | parameters: [GLuint], 295 | result: GLboolean, 296 | }, 297 | 298 | /// 5.14.7 Renderbuffer objects 299 | 300 | bindRenderbuffer: { 301 | parameters: [GLenum, GLuint], 302 | result: "void", 303 | }, 304 | 305 | genRenderbuffers: { 306 | parameters: [GLsizei, GLuintv], 307 | result: "void", 308 | }, 309 | 310 | deleteRenderbuffers: { 311 | parameters: [GLsizei, GLuintv], 312 | result: "void", 313 | }, 314 | 315 | getRenderbufferParameteriv: { 316 | parameters: [GLenum, GLenum, GLintv], 317 | result: "void", 318 | }, 319 | 320 | isRenderbuffer: { 321 | parameters: [GLuint], 322 | result: GLboolean, 323 | }, 324 | 325 | renderbufferStorage: { 326 | parameters: [GLenum, GLenum, GLsizei, GLsizei], 327 | result: "void", 328 | }, 329 | 330 | /// 5.14.8 Texture objects 331 | 332 | bindTexture: { 333 | parameters: [GLenum, GLuint], 334 | result: "void", 335 | }, 336 | 337 | compressedTexImage2D: { 338 | parameters: [ 339 | GLenum, 340 | GLint, 341 | GLenum, 342 | GLsizei, 343 | GLsizei, 344 | GLint, 345 | GLsizei, 346 | GLvoidptr, 347 | ], 348 | result: "void", 349 | }, 350 | 351 | compressedTexSubImage2D: { 352 | parameters: [ 353 | GLenum, 354 | GLint, 355 | GLint, 356 | GLint, 357 | GLsizei, 358 | GLsizei, 359 | GLenum, 360 | GLsizei, 361 | GLvoidptr, 362 | ], 363 | result: "void", 364 | }, 365 | 366 | copyTexImage2D: { 367 | parameters: [ 368 | GLenum, 369 | GLint, 370 | GLenum, 371 | GLint, 372 | GLint, 373 | GLsizei, 374 | GLsizei, 375 | GLint, 376 | ], 377 | result: "void", 378 | }, 379 | 380 | copyTexSubImage2D: { 381 | parameters: [ 382 | GLenum, 383 | GLint, 384 | GLint, 385 | GLint, 386 | GLint, 387 | GLint, 388 | GLsizei, 389 | GLsizei, 390 | ], 391 | result: "void", 392 | }, 393 | 394 | genTextures: { 395 | parameters: [GLsizei, GLuintv], 396 | result: "void", 397 | }, 398 | 399 | deleteTextures: { 400 | parameters: [GLsizei, GLuintv], 401 | result: "void", 402 | }, 403 | 404 | generateMipmap: { 405 | parameters: [GLenum], 406 | result: "void", 407 | }, 408 | 409 | getTexParameteriv: { 410 | parameters: [GLenum, GLenum, GLintv], 411 | result: "void", 412 | }, 413 | 414 | isTexture: { 415 | parameters: [GLuint], 416 | result: GLboolean, 417 | }, 418 | 419 | texImage2D: { 420 | parameters: [ 421 | GLenum, 422 | GLint, 423 | GLint, 424 | GLsizei, 425 | GLsizei, 426 | GLint, 427 | GLenum, 428 | GLenum, 429 | GLvoidptr, 430 | ], 431 | result: "void", 432 | }, 433 | 434 | texParameterf: { 435 | parameters: [GLenum, GLenum, GLfloat], 436 | result: "void", 437 | }, 438 | 439 | texParameteri: { 440 | parameters: [GLenum, GLenum, GLint], 441 | result: "void", 442 | }, 443 | 444 | texSubImage2D: { 445 | parameters: [ 446 | GLenum, 447 | GLint, 448 | GLint, 449 | GLint, 450 | GLsizei, 451 | GLsizei, 452 | GLenum, 453 | GLenum, 454 | GLvoidptr, 455 | ], 456 | result: "void", 457 | }, 458 | 459 | /// 5.14.9 Programs and Shaders 460 | 461 | attachShader: { 462 | parameters: [GLuint, GLuint], 463 | result: "void", 464 | }, 465 | 466 | bindAttribLocation: { 467 | parameters: [GLuint, GLuint, GLcharptr], 468 | result: "void", 469 | }, 470 | 471 | compileShader: { 472 | parameters: [GLuint], 473 | result: "void", 474 | }, 475 | 476 | createProgram: { 477 | parameters: [], 478 | result: GLuint, 479 | }, 480 | 481 | createShader: { 482 | parameters: [GLenum], 483 | result: GLuint, 484 | }, 485 | 486 | deleteProgram: { 487 | parameters: [GLuint], 488 | result: "void", 489 | }, 490 | 491 | deleteShader: { 492 | parameters: [GLuint], 493 | result: "void", 494 | }, 495 | 496 | detachShader: { 497 | parameters: [GLuint, GLuint], 498 | result: "void", 499 | }, 500 | 501 | getAttachedShaders: { 502 | parameters: [GLuint, GLsizei, GLuintv, GLuintv], 503 | result: "void", 504 | }, 505 | 506 | getProgramiv: { 507 | parameters: [GLuint, GLenum, GLintv], 508 | result: "void", 509 | }, 510 | 511 | getProgramInfoLog: { 512 | parameters: [GLuint, GLsizei, GLintv, GLcharptr], 513 | result: "void", 514 | }, 515 | 516 | getShaderiv: { 517 | parameters: [GLuint, GLenum, GLintv], 518 | result: "void", 519 | }, 520 | 521 | getShaderPrecisionFormat: { 522 | parameters: [GLenum, GLenum, GLintv, GLintv], 523 | result: "void", 524 | }, 525 | 526 | getShaderInfoLog: { 527 | parameters: [GLuint, GLsizei, GLintv, GLcharptr], 528 | result: "void", 529 | }, 530 | 531 | getShaderSource: { 532 | parameters: [GLuint, GLsizei, GLintv, GLcharptr], 533 | result: "void", 534 | }, 535 | 536 | isProgram: { 537 | parameters: [GLuint], 538 | result: GLboolean, 539 | }, 540 | 541 | isShader: { 542 | parameters: [GLuint], 543 | result: GLboolean, 544 | }, 545 | 546 | linkProgram: { 547 | parameters: [GLuint], 548 | result: "void", 549 | }, 550 | 551 | shaderSource: { 552 | parameters: [GLuint, GLsizei, GLcharptr, GLintv], 553 | result: "void", 554 | }, 555 | 556 | useProgram: { 557 | parameters: [GLuint], 558 | result: "void", 559 | }, 560 | 561 | validateProgram: { 562 | parameters: [GLuint], 563 | result: "void", 564 | }, 565 | 566 | /// 5.14.10 Uniforms and attributes 567 | 568 | disableVertexAttribArray: { 569 | parameters: [GLuint], 570 | result: "void", 571 | }, 572 | 573 | enableVertexAttribArray: { 574 | parameters: [GLuint], 575 | result: "void", 576 | }, 577 | 578 | getActiveAttrib: { 579 | parameters: [GLuint, GLuint, GLsizei, GLuintv, GLintv, GLenumv, GLcharptr], 580 | result: "void", 581 | }, 582 | 583 | getActiveUniform: { 584 | parameters: [ 585 | GLuint, 586 | GLuint, 587 | GLsizei, 588 | GLuintv, 589 | GLintv, 590 | GLenumv, 591 | GLcharptr, 592 | ], 593 | result: "void", 594 | }, 595 | 596 | getAttribLocation: { 597 | parameters: [GLuint, GLcharptr], 598 | result: GLint, 599 | }, 600 | 601 | getUniformfv: { 602 | parameters: [GLuint, GLint, GLfloatv], 603 | result: "void", 604 | }, 605 | 606 | getUniformiv: { 607 | parameters: [GLuint, GLint, GLintv], 608 | result: "void", 609 | }, 610 | 611 | getUniformLocation: { 612 | parameters: [GLuint, GLcharptr], 613 | result: GLint, 614 | }, 615 | 616 | getVertexAttribfv: { 617 | parameters: [GLuint, GLenum, GLfloatv], 618 | result: "void", 619 | }, 620 | 621 | getVertexAttribiv: { 622 | parameters: [GLuint, GLenum, GLintv], 623 | result: "void", 624 | }, 625 | 626 | getVertexAttribPointerv: { 627 | parameters: [GLuint, GLenum, GLvoidptr], 628 | result: "void", 629 | }, 630 | 631 | uniform1f: { 632 | parameters: [GLint, GLfloat], 633 | result: "void", 634 | }, 635 | 636 | uniform2f: { 637 | parameters: [GLint, GLfloat, GLfloat], 638 | result: "void", 639 | }, 640 | 641 | uniform3f: { 642 | parameters: [GLint, GLfloat, GLfloat, GLfloat], 643 | result: "void", 644 | }, 645 | 646 | uniform4f: { 647 | parameters: [GLint, GLfloat, GLfloat, GLfloat, GLfloat], 648 | result: "void", 649 | }, 650 | 651 | uniform1i: { 652 | parameters: [GLint, GLint], 653 | result: "void", 654 | }, 655 | 656 | uniform2i: { 657 | parameters: [GLint, GLint, GLint], 658 | result: "void", 659 | }, 660 | 661 | uniform3i: { 662 | parameters: [GLint, GLint, GLint, GLint], 663 | result: "void", 664 | }, 665 | 666 | uniform4i: { 667 | parameters: [GLint, GLint, GLint, GLint, GLint], 668 | result: "void", 669 | }, 670 | 671 | uniform1fv: { 672 | parameters: [GLint, GLsizei, GLfloatv], 673 | result: "void", 674 | }, 675 | 676 | uniform2fv: { 677 | parameters: [GLint, GLsizei, GLfloatv], 678 | result: "void", 679 | }, 680 | 681 | uniform3fv: { 682 | parameters: [GLint, GLsizei, GLfloatv], 683 | result: "void", 684 | }, 685 | 686 | uniform4fv: { 687 | parameters: [GLint, GLsizei, GLfloatv], 688 | result: "void", 689 | }, 690 | 691 | uniform1iv: { 692 | parameters: [GLint, GLsizei, GLintv], 693 | result: "void", 694 | }, 695 | 696 | uniform2iv: { 697 | parameters: [GLint, GLsizei, GLintv], 698 | result: "void", 699 | }, 700 | 701 | uniform3iv: { 702 | parameters: [GLint, GLsizei, GLintv], 703 | result: "void", 704 | }, 705 | 706 | uniform4iv: { 707 | parameters: [GLint, GLsizei, GLintv], 708 | result: "void", 709 | }, 710 | 711 | uniformMatrix2fv: { 712 | parameters: [GLint, GLsizei, GLboolean, GLfloatv], 713 | result: "void", 714 | }, 715 | 716 | uniformMatrix3fv: { 717 | parameters: [GLint, GLsizei, GLboolean, GLfloatv], 718 | result: "void", 719 | }, 720 | 721 | uniformMatrix4fv: { 722 | parameters: [GLint, GLsizei, GLboolean, GLfloatv], 723 | result: "void", 724 | }, 725 | 726 | vertexAttrib1f: { 727 | parameters: [GLuint, GLfloat], 728 | result: "void", 729 | }, 730 | 731 | vertexAttrib2f: { 732 | parameters: [GLuint, GLfloat, GLfloat], 733 | result: "void", 734 | }, 735 | 736 | vertexAttrib3f: { 737 | parameters: [GLuint, GLfloat, GLfloat, GLfloat], 738 | result: "void", 739 | }, 740 | 741 | vertexAttrib4f: { 742 | parameters: [GLuint, GLfloat, GLfloat, GLfloat, GLfloat], 743 | result: "void", 744 | }, 745 | 746 | vertexAttrib1fv: { 747 | parameters: [GLuint, GLfloatv], 748 | result: "void", 749 | }, 750 | 751 | vertexAttrib2fv: { 752 | parameters: [GLuint, GLfloatv], 753 | result: "void", 754 | }, 755 | 756 | vertexAttrib3fv: { 757 | parameters: [GLuint, GLfloatv], 758 | result: "void", 759 | }, 760 | 761 | vertexAttrib4fv: { 762 | parameters: [GLuint, GLfloatv], 763 | result: "void", 764 | }, 765 | 766 | vertexAttribPointer: { 767 | parameters: [ 768 | GLuint, 769 | GLint, 770 | GLenum, 771 | GLboolean, 772 | GLsizei, 773 | GLvoidptr, 774 | ], 775 | result: "void", 776 | }, 777 | 778 | /// 5.14.11 Writing to the drawing buffer 779 | 780 | clear: { 781 | parameters: [GLbitfield], 782 | result: "void", 783 | }, 784 | 785 | drawArrays: { 786 | parameters: [GLenum, GLint, GLsizei], 787 | result: "void", 788 | }, 789 | 790 | drawElements: { 791 | parameters: [GLenum, GLsizei, GLenum, GLvoidptr], 792 | result: "void", 793 | }, 794 | 795 | finish: { 796 | parameters: [], 797 | result: "void", 798 | }, 799 | 800 | flush: { 801 | parameters: [], 802 | result: "void", 803 | }, 804 | 805 | /// 5.14.12 Reading back pixels 806 | 807 | readPixels: { 808 | parameters: [ 809 | GLint, 810 | GLint, 811 | GLsizei, 812 | GLsizei, 813 | GLenum, 814 | GLenum, 815 | GLvoidptr, 816 | ], 817 | result: "void", 818 | }, 819 | 820 | //// WebGL 2 821 | 822 | /// 3.7.2 Setting and getting state 823 | 824 | getInteger64v: { 825 | parameters: [GLenum, GLint64v], 826 | result: "void", 827 | }, 828 | 829 | getIntegeri_v: { 830 | parameters: [GLenum, GLuint, GLintv], 831 | result: "void", 832 | }, 833 | 834 | getInteger64i_v: { 835 | parameters: [GLenum, GLuint, GLint64v], 836 | result: "void", 837 | }, 838 | 839 | /// 3.7.3 Buffer objects 840 | 841 | getBufferParameteri64v: { 842 | parameters: [GLenum, GLenum, GLint64v], 843 | result: "void", 844 | }, 845 | 846 | copyBufferSubData: { 847 | parameters: [GLenum, GLenum, GLintptr, GLintptr, GLsizeiptr], 848 | result: "void", 849 | }, 850 | 851 | mapBufferRange: { 852 | parameters: [ 853 | GLenum, 854 | GLintptr, 855 | GLsizeiptr, 856 | GLbitfield, 857 | ], 858 | result: GLvoidptr, 859 | }, 860 | 861 | unmapBuffer: { 862 | parameters: [GLenum], 863 | result: GLboolean, 864 | }, 865 | 866 | /// 3.7.4 Framebuffer objects 867 | 868 | blitFramebuffer: { 869 | parameters: [ 870 | GLint, 871 | GLint, 872 | GLint, 873 | GLint, 874 | GLint, 875 | GLint, 876 | GLint, 877 | GLint, 878 | GLbitfield, 879 | GLenum, 880 | ], 881 | result: "void", 882 | }, 883 | 884 | framebufferTextureLayer: { 885 | parameters: [GLenum, GLenum, GLuint, GLint, GLint], 886 | result: "void", 887 | }, 888 | 889 | invalidateFramebuffer: { 890 | parameters: [GLenum, GLsizei, GLenumv], 891 | result: "void", 892 | }, 893 | 894 | invalidateSubFramebuffer: { 895 | parameters: [GLenum, GLsizei, GLenumv, GLint, GLint, GLsizei, GLsizei], 896 | result: "void", 897 | }, 898 | 899 | readBuffer: { 900 | parameters: [GLenum], 901 | result: "void", 902 | }, 903 | 904 | /// 3.7.5 Renderbuffer objects 905 | 906 | getInternalformativ: { 907 | parameters: [ 908 | GLenum, 909 | GLenum, 910 | GLenum, 911 | GLsizei, 912 | GLintv, 913 | ], 914 | result: "void", 915 | }, 916 | 917 | renderbufferStorageMultisample: { 918 | parameters: [ 919 | GLenum, 920 | GLsizei, 921 | GLenum, 922 | GLsizei, 923 | GLsizei, 924 | ], 925 | result: "void", 926 | }, 927 | 928 | /// 3.7.6 Texture objects 929 | 930 | getTexParameterfv: { 931 | parameters: [GLenum, GLenum, GLfloatv], 932 | result: "void", 933 | }, 934 | 935 | texStorage2D: { 936 | parameters: [GLenum, GLsizei, GLenum, GLsizei, GLsizei], 937 | result: "void", 938 | }, 939 | 940 | texStorage3D: { 941 | parameters: [GLenum, GLsizei, GLenum, GLsizei, GLsizei, GLsizei], 942 | result: "void", 943 | }, 944 | 945 | texSubImage3D: { 946 | parameters: [ 947 | GLenum, 948 | GLint, 949 | GLint, 950 | GLint, 951 | GLint, 952 | GLsizei, 953 | GLsizei, 954 | GLsizei, 955 | GLenum, 956 | GLenum, 957 | GLvoidptr, 958 | ], 959 | result: "void", 960 | }, 961 | 962 | /// 3.7.7 Programs and Shaders 963 | 964 | getFragDataLocation: { 965 | parameters: [GLuint, GLcharptr], 966 | result: GLint, 967 | }, 968 | 969 | /// 3.7.11 Multiple render targets 970 | 971 | drawBuffers: { 972 | parameters: [GLsizei, GLenumv], 973 | result: "void", 974 | }, 975 | 976 | clearBufferfv: { 977 | parameters: [GLenum, GLint, GLfloatv], 978 | result: "void", 979 | }, 980 | 981 | clearBufferiv: { 982 | parameters: [GLenum, GLint, GLintv], 983 | result: "void", 984 | }, 985 | 986 | clearBufferuiv: { 987 | parameters: [GLenum, GLint, GLuintv], 988 | result: "void", 989 | }, 990 | 991 | clearBufferfi: { 992 | parameters: [GLenum, GLint, GLfloat, GLint], 993 | result: "void", 994 | }, 995 | 996 | /// 3.7.13 Sampler objects 997 | 998 | genSamplers: { 999 | parameters: [GLsizei, GLuintv], 1000 | result: "void", 1001 | }, 1002 | 1003 | deleteSamplers: { 1004 | parameters: [GLsizei, GLuintv], 1005 | result: "void", 1006 | }, 1007 | 1008 | isSampler: { 1009 | parameters: [GLuint], 1010 | result: GLboolean, 1011 | }, 1012 | 1013 | bindSampler: { 1014 | parameters: [GLuint, GLuint], 1015 | result: "void", 1016 | }, 1017 | 1018 | samplerParameteri: { 1019 | parameters: [GLuint, GLenum, GLint], 1020 | result: "void", 1021 | }, 1022 | 1023 | samplerParameterf: { 1024 | parameters: [GLuint, GLenum, GLfloat], 1025 | result: "void", 1026 | }, 1027 | 1028 | getSamplerParameterfv: { 1029 | parameters: [GLuint, GLenum, GLfloatv], 1030 | result: "void", 1031 | }, 1032 | 1033 | getSamplerParameteriv: { 1034 | parameters: [GLuint, GLenum, GLintv], 1035 | result: "void", 1036 | }, 1037 | 1038 | /// 3.7.17 Vertex Array objects 1039 | 1040 | bindVertexArray: { 1041 | parameters: [GLuint], 1042 | result: "void", 1043 | }, 1044 | 1045 | genVertexArrays: { 1046 | parameters: [GLuint, GLuintv], 1047 | result: GLuint, 1048 | }, 1049 | 1050 | deleteVertexArrays: { 1051 | parameters: [GLuint, GLuintv], 1052 | result: "void", 1053 | }, 1054 | 1055 | isVertexArray: { 1056 | parameters: [GLuint], 1057 | result: GLboolean, 1058 | }, 1059 | 1060 | /// 3.7.12 Query objects 1061 | 1062 | genQueries: { 1063 | parameters: [GLsizei, GLuintv], 1064 | result: GLuint, 1065 | }, 1066 | 1067 | deleteQueries: { 1068 | parameters: [GLsizei, GLuintv], 1069 | result: "void", 1070 | }, 1071 | 1072 | isQuery: { 1073 | parameters: [GLuint], 1074 | result: GLboolean, 1075 | }, 1076 | 1077 | beginQuery: { 1078 | parameters: [GLenum, GLuint], 1079 | result: "void", 1080 | }, 1081 | 1082 | endQuery: { 1083 | parameters: [GLenum], 1084 | result: "void", 1085 | }, 1086 | 1087 | getQueryiv: { 1088 | parameters: [GLenum, GLenum, GLintv], 1089 | result: "void", 1090 | }, 1091 | 1092 | getQueryObjectuiv: { 1093 | parameters: [GLuint, GLenum, GLuintv], 1094 | result: "void", 1095 | }, 1096 | 1097 | /// 3.7.14 Sync objects 1098 | 1099 | fenceSync: { 1100 | parameters: [GLenum, GLbitfield], 1101 | result: GLuint, 1102 | }, 1103 | 1104 | isSync: { 1105 | parameters: [GLuint], 1106 | result: GLboolean, 1107 | }, 1108 | 1109 | deleteSync: { 1110 | parameters: [GLuint], 1111 | result: "void", 1112 | }, 1113 | 1114 | clientWaitSync: { 1115 | parameters: [GLuint, GLbitfield, GLuint64], 1116 | result: GLenum, 1117 | }, 1118 | 1119 | waitSync: { 1120 | parameters: [GLuint, GLbitfield, GLuint64], 1121 | result: "void", 1122 | }, 1123 | 1124 | getSynciv: { 1125 | parameters: [GLuint, GLenum, GLsizei, GLuintv, GLintv], 1126 | result: "void", 1127 | }, 1128 | 1129 | /// 3.7.15 Transform feedback 1130 | 1131 | genTransformFeedbacks: { 1132 | parameters: [GLsizei, GLuintv], 1133 | result: "void", 1134 | }, 1135 | 1136 | deleteTransformFeedbacks: { 1137 | parameters: [GLsizei, GLuintv], 1138 | result: "void", 1139 | }, 1140 | 1141 | isTransformFeedback: { 1142 | parameters: [GLuint], 1143 | result: GLboolean, 1144 | }, 1145 | 1146 | bindTransformFeedback: { 1147 | parameters: [GLenum, GLuint], 1148 | result: "void", 1149 | }, 1150 | 1151 | beginTransformFeedback: { 1152 | parameters: [GLenum], 1153 | result: "void", 1154 | }, 1155 | 1156 | endTransformFeedback: { 1157 | parameters: [], 1158 | result: "void", 1159 | }, 1160 | 1161 | pauseTransformFeedback: { 1162 | parameters: [], 1163 | result: "void", 1164 | }, 1165 | 1166 | resumeTransformFeedback: { 1167 | parameters: [], 1168 | result: "void", 1169 | }, 1170 | 1171 | transformFeedbackVaryings: { 1172 | parameters: [ 1173 | GLuint, 1174 | GLsizei, 1175 | GLcharptr, 1176 | GLenum, 1177 | ], 1178 | result: "void", 1179 | }, 1180 | 1181 | getTransformFeedbackVarying: { 1182 | parameters: [ 1183 | GLuint, 1184 | GLuint, 1185 | GLsizei, 1186 | GLvoidptr, 1187 | GLvoidptr, 1188 | GLvoidptr, 1189 | GLcharptr, 1190 | ], 1191 | result: "void", 1192 | }, 1193 | 1194 | /// 3.7.16 Uniform Buffer objects 1195 | 1196 | bindBufferBase: { 1197 | parameters: [GLenum, GLuint, GLuint], 1198 | result: "void", 1199 | }, 1200 | 1201 | bindBufferRange: { 1202 | parameters: [ 1203 | GLenum, 1204 | GLuint, 1205 | GLuint, 1206 | GLintptr, 1207 | GLsizeiptr, 1208 | ], 1209 | result: "void", 1210 | }, 1211 | 1212 | getUniformIndices: { 1213 | parameters: [GLuint, GLsizei, GLcharptr, GLuintv], 1214 | result: "void", 1215 | }, 1216 | 1217 | getActiveUniformsiv: { 1218 | parameters: [GLuint, GLsizei, GLuintv, GLenum, GLintv], 1219 | result: "void", 1220 | }, 1221 | 1222 | getUniformBlockIndex: { 1223 | parameters: [GLuint, GLcharptr], 1224 | result: GLuint, 1225 | }, 1226 | 1227 | getActiveUniformBlockiv: { 1228 | parameters: [GLuint, GLuint, GLenum, GLintv], 1229 | result: "void", 1230 | }, 1231 | 1232 | getActiveUniformBlockName: { 1233 | parameters: [GLuint, GLuint, GLsizei, GLvoidptr, GLcharptr], 1234 | result: "void", 1235 | }, 1236 | 1237 | uniformBlockBinding: { 1238 | parameters: [GLuint, GLuint, GLuint], 1239 | result: "void", 1240 | }, 1241 | } as const; 1242 | 1243 | export type Symbols = { 1244 | -readonly [K in keyof typeof symbols]: { 1245 | // Make non-readonly 1246 | parameters: [...(typeof symbols)[K]["parameters"]]; 1247 | result: (typeof symbols)[K]["result"]; 1248 | }; 1249 | }; 1250 | 1251 | const gl = new GL_CONST() as unknown as MapFFI & GL_CONST; 1252 | 1253 | function prefixGl(name: string) { 1254 | return `gl${name[0].toUpperCase()}${name.slice(1)}`; 1255 | } 1256 | 1257 | const DEBUG = Deno.env.get("DENO_GL_DEBUG") === "1"; 1258 | 1259 | function checkErrors(name: string, args: any[], res: any) { 1260 | if (!DEBUG) return; 1261 | let err; 1262 | while ( 1263 | name !== "getError" && (err = gl.getError()) != gl.NO_ERROR 1264 | ) { 1265 | console.error( 1266 | `%cerror%c: ${name}(${ 1267 | args.map((e) => Deno.inspect(e, { colors: true })).join(", ") 1268 | }) threw 0x${err.toString(16)} (and returned ${ 1269 | Deno.inspect(res, { colors: true }) 1270 | })`, 1271 | "color: red", 1272 | "", 1273 | ); 1274 | } 1275 | } 1276 | 1277 | export function init(GetProcAddress: (name: string) => Deno.UnsafePointer) { 1278 | for (const name in symbols) { 1279 | const glName = prefixGl(name); 1280 | 1281 | const ptr = GetProcAddress(glName); 1282 | 1283 | if (ptr.value === 0n) { 1284 | console.error(`GetProcAddress(${glName}) returned nullptr`); 1285 | } 1286 | 1287 | const fnptr = new Deno.UnsafeFnPointer( 1288 | ptr, 1289 | (symbols as Record)[name], 1290 | ); 1291 | 1292 | gl[name as keyof Symbols] = ((...args: any[]) => { 1293 | if (ptr.value === 0n) { 1294 | // throw new Error(`GetProcAddress(${glName}) returned nullptr`); 1295 | return; 1296 | } 1297 | const res = fnptr.call(...args); 1298 | checkErrors(name, args, res); 1299 | return res; 1300 | }) as any; 1301 | } 1302 | } 1303 | 1304 | export default gl; 1305 | -------------------------------------------------------------------------------- /src/core/util.ts: -------------------------------------------------------------------------------- 1 | export type MapType = T extends "u8" ? number 2 | : T extends "i8" ? number 3 | : T extends "u16" ? number 4 | : T extends "i16" ? number 5 | : T extends "u32" ? number 6 | : T extends "i32" ? number 7 | : T extends "u64" ? number 8 | : T extends "i64" ? number 9 | : T extends "f32" ? number 10 | : T extends "f64" ? number 11 | : T extends "pointer" ? Deno.UnsafePointer 12 | : T extends "void" ? void 13 | : never; 14 | 15 | export type MapParamType = T extends "pointer" ? ( 16 | | Deno.UnsafePointer 17 | | null 18 | | Uint8Array 19 | | Uint8ClampedArray 20 | | Int8Array 21 | | Uint16Array 22 | | Int16Array 23 | | Float32Array 24 | | Float64Array 25 | | Uint32Array 26 | | Int32Array 27 | | BigUint64Array 28 | | BigInt64Array 29 | ) 30 | : MapType; 31 | 32 | export type MapParameters = [ 33 | ...{ 34 | [K in keyof T]: T[K] extends Deno.NativeType ? MapParamType : unknown; 35 | }, 36 | ]; 37 | 38 | export type MapFunction = ( 39 | ...args: MapParameters 40 | ) => T["nonblocking"] extends true ? Promise> 41 | : MapType; 42 | 43 | export type MapFFI> = { 44 | [name in keyof T]: MapFunction; 45 | }; 46 | 47 | export function cstr(str: string) { 48 | const buffer = new Uint8Array(str.length + 1); 49 | new TextEncoder().encodeInto(str, buffer); 50 | return buffer; 51 | } 52 | 53 | export const OS_LIB_PREFIX = Deno.build.os === "windows" ? "" : "lib"; 54 | 55 | export const OS_LIB_SUFFIX = Deno.build.os === "windows" 56 | ? "dll" 57 | : Deno.build.os === "darwin" 58 | ? "dylib" 59 | : "so"; 60 | -------------------------------------------------------------------------------- /src/web/README.md: -------------------------------------------------------------------------------- 1 | # deno_gl/web 2 | 3 | High-level Web API bindings (WebGL, etc). 4 | -------------------------------------------------------------------------------- /src/web/animation.ts: -------------------------------------------------------------------------------- 1 | import glfw from "../core/glfw.ts"; 2 | 3 | let lastTime = 0; 4 | 5 | export function requestAnimationFrame(callback: (delta: number) => void) { 6 | const currTime = performance.now(); 7 | const timeToCall = Math.max(0, 1000 / 60 - (currTime - lastTime)); 8 | const id = window.setTimeout(function () { 9 | callback(currTime + timeToCall); 10 | glfw.pollEvents(); 11 | }, timeToCall); 12 | lastTime = currTime + timeToCall; 13 | return id; 14 | } 15 | 16 | export function cancelAnimationFrame(id: number) { 17 | clearTimeout(id); 18 | } 19 | 20 | declare global { 21 | interface Window { 22 | innerHeight: number; 23 | innerWidth: number; 24 | devicePixelRatio: number; 25 | pageXOffset: number; 26 | pageYOffset: number; 27 | 28 | requestAnimationFrame: typeof requestAnimationFrame; 29 | cancelAnimationFrame: typeof cancelAnimationFrame; 30 | } 31 | } 32 | 33 | Object.defineProperties(window, { 34 | requestAnimationFrame: { 35 | value: requestAnimationFrame, 36 | writable: false, 37 | }, 38 | cancelAnimationFrame: { 39 | value: cancelAnimationFrame, 40 | writable: false, 41 | }, 42 | devicePixelRatio: { 43 | get: () => { 44 | const window = glfw.getCurrentContext(); 45 | const scaleX = new Float32Array(1); 46 | const scaleY = new Float32Array(1); 47 | glfw.getWindowContentScale(window, scaleX, scaleY); 48 | if (scaleX[0] !== 1 || scaleY[0] !== 1) { 49 | console.log("devicePixelRatio", scaleX[0], scaleY[0]); 50 | } 51 | return scaleX[0]; 52 | }, 53 | }, 54 | pageXOffset: { 55 | value: 0, 56 | }, 57 | pageYOffset: { 58 | value: 0, 59 | }, 60 | innerHeight: { 61 | get: () => { 62 | const window = glfw.getCurrentContext(); 63 | const height = new Int32Array(1); 64 | glfw.getWindowSize(window, null, height); 65 | return height[0]; 66 | }, 67 | }, 68 | innerWidth: { 69 | get: () => { 70 | const window = glfw.getCurrentContext(); 71 | const width = new Int32Array(1); 72 | glfw.getWindowSize(window, width, null); 73 | return width[0]; 74 | }, 75 | }, 76 | }); 77 | -------------------------------------------------------------------------------- /src/web/canvas.ts: -------------------------------------------------------------------------------- 1 | import { cstr, gl, glfw, initGL } from "../core/mod.ts"; 2 | import { WebGL2RenderingContext, WebGLContextAttributes } from "./context.ts"; 3 | import { HTMLElement } from "./element.ts"; 4 | 5 | let init = false; 6 | 7 | export interface CanvasOptions { 8 | title: string; 9 | width: number; 10 | height: number; 11 | visible?: boolean; 12 | resizable?: boolean; 13 | } 14 | 15 | export class Canvas extends HTMLElement { 16 | handle: Deno.UnsafePointer; 17 | #title: string; 18 | 19 | constructor(options: CanvasOptions) { 20 | super(); 21 | 22 | if (!init) { 23 | if (!glfw.init()) { 24 | throw new Error("Failed to initialize GLFW"); 25 | } 26 | 27 | // if (Deno.build.os === "darwin") { 28 | // For using ANGLE 29 | glfw.windowHint(glfw.CONTEXT_CREATION_API, glfw.EGL_CONTEXT_API); 30 | // } 31 | 32 | glfw.windowHint(glfw.SAMPLES, 4); 33 | glfw.windowHint(glfw.CLIENT_API, glfw.OPENGL_ES_API); 34 | glfw.windowHint(glfw.CONTEXT_VERSION_MAJOR, 3); 35 | glfw.windowHint(glfw.CONTEXT_VERSION_MINOR, 0); 36 | glfw.windowHint(glfw.OPENGL_FORWARD_COMPAT, glfw.OPENGL_CORE_PROFILE); 37 | 38 | init = true; 39 | } 40 | 41 | this.#title = options.title; 42 | 43 | glfw.windowHint( 44 | glfw.VISIBLE, 45 | options.visible === false ? glfw.FALSE : glfw.TRUE, 46 | ); 47 | glfw.windowHint( 48 | glfw.RESIZABLE, 49 | options.resizable === true ? glfw.TRUE : glfw.FALSE, 50 | ); 51 | 52 | this.handle = glfw.createWindow( 53 | options.width, 54 | options.height, 55 | cstr(options.title), 56 | null, 57 | null, 58 | ); 59 | 60 | if (this.handle.value === 0n) { 61 | const errptr = new BigUint64Array(1); 62 | throw new Error( 63 | `Failed to create window ${glfw.getError(errptr)} ${ 64 | new Deno.UnsafePointerView(new Deno.UnsafePointer(errptr[0])) 65 | .getCString() 66 | }`, 67 | ); 68 | } 69 | 70 | glfw.setInputMode(this.handle, glfw.STICKY_KEYS, gl.TRUE); 71 | glfw.setInputMode(this.handle, glfw.CURSOR, glfw.CURSOR_NORMAL); 72 | 73 | glfw.makeContextCurrent(this.handle); 74 | initGL(); 75 | 76 | gl.enable(gl.DEBUG_OUTPUT); 77 | // TODO: once FFI supports callbacks 78 | // gl.debugMessageCallback(cb); 79 | } 80 | 81 | get title() { 82 | return this.#title; 83 | } 84 | 85 | set title(value: string) { 86 | glfw.setWindowTitle(this.handle, cstr(value)); 87 | this.#title = value; 88 | } 89 | 90 | get width() { 91 | const width = new Int32Array(1); 92 | const height = new Int32Array(1); 93 | glfw.getWindowSize(this.handle, width, height); 94 | return width[0]; 95 | } 96 | 97 | set width(value: number) { 98 | if (isNaN(value)) { 99 | throw new Error("width must be a number"); 100 | } 101 | glfw.setWindowSize(this.handle, value, this.height); 102 | } 103 | 104 | get height() { 105 | const width = new Int32Array(1); 106 | const height = new Int32Array(1); 107 | glfw.getWindowSize(this.handle, width, height); 108 | return height[0]; 109 | } 110 | 111 | set height(value: number) { 112 | if (isNaN(value)) { 113 | throw new Error("height must be a number"); 114 | } 115 | glfw.setWindowSize(this.handle, this.width, value); 116 | } 117 | 118 | get offsetWidth() { 119 | return this.width; 120 | } 121 | 122 | get offsetHeight() { 123 | return this.height; 124 | } 125 | 126 | get clientWidth() { 127 | return this.width; 128 | } 129 | 130 | get clientHeight() { 131 | return this.height; 132 | } 133 | 134 | getContext(type: string, attrs?: WebGLContextAttributes) { 135 | switch (type) { 136 | case "webgl": 137 | case "experimental-webgl": 138 | case "webgl2": { 139 | const ctx = new WebGL2RenderingContext( 140 | this, 141 | Object.assign({ 142 | alpha: false, 143 | depth: false, 144 | stencil: false, 145 | antialias: true, 146 | premultipliedAlpha: false, 147 | preserveDrawingBuffer: false, 148 | powerPreference: "default", 149 | }, attrs), 150 | ); 151 | if (Deno.env.get("DEBUG_DENO_GL") === "1") { 152 | return new Proxy(ctx, { 153 | get: (t, p) => { 154 | const v = (t as any)[p]; 155 | if (typeof v === "function") { 156 | return (...args: any[]) => { 157 | const result = v.apply(t, args); 158 | // if (p.toString().match(/tex/i)) console.log(p, args, "->", result); 159 | return result; 160 | }; 161 | } else { 162 | if (v === undefined) { 163 | throw new Error(`${String(p)} is undefined`); 164 | } 165 | return v; 166 | } 167 | }, 168 | }); 169 | } 170 | return ctx; 171 | } 172 | 173 | default: 174 | return null; 175 | } 176 | } 177 | 178 | shouldClose() { 179 | return Boolean(glfw.windowShouldClose(this.handle)); 180 | } 181 | 182 | swapBuffers() { 183 | glfw.swapBuffers(this.handle); 184 | } 185 | 186 | show() { 187 | glfw.showWindow(this.handle); 188 | } 189 | 190 | hide() { 191 | glfw.hideWindow(this.handle); 192 | } 193 | 194 | focus() { 195 | glfw.focusWindow(this.handle); 196 | } 197 | 198 | restore() { 199 | glfw.restoreWindow(this.handle); 200 | } 201 | 202 | maximize() { 203 | glfw.maximizeWindow(this.handle); 204 | } 205 | 206 | requestAttention() { 207 | glfw.requestWindowAttention(this.handle); 208 | } 209 | 210 | destroy() { 211 | glfw.destroyWindow(this.handle); 212 | } 213 | 214 | getBoundingClientRect() { 215 | return { 216 | top: 0, 217 | left: 0, 218 | width: this.width, 219 | height: this.height, 220 | right: this.width, 221 | bottom: this.height, 222 | }; 223 | } 224 | 225 | // TODO: switch to callback-based events once FFI supports them. 226 | // they're likely more efficient. 227 | 228 | state: any = {}; 229 | 230 | getCurrentState() { 231 | const cursorPosX = new Float64Array(1); 232 | const cursorPosY = new Float64Array(1); 233 | glfw.getCursorPos(this.handle, cursorPosX, cursorPosY); 234 | return { 235 | keyW: glfw.getKey(this.handle, glfw.KEY_W) === glfw.TRUE, 236 | keyA: glfw.getKey(this.handle, glfw.KEY_A) === glfw.TRUE, 237 | keyS: glfw.getKey(this.handle, glfw.KEY_S) === glfw.TRUE, 238 | keyD: glfw.getKey(this.handle, glfw.KEY_D) === glfw.TRUE, 239 | mouseButtonLeft: Boolean( 240 | glfw.getMouseButton(this.handle, glfw.MOUSE_BUTTON_LEFT), 241 | ), 242 | mouseButtonRight: Boolean(glfw.getMouseButton( 243 | this.handle, 244 | glfw.MOUSE_BUTTON_RIGHT, 245 | )), 246 | mouseButtonMiddle: Boolean(glfw.getMouseButton( 247 | this.handle, 248 | glfw.MOUSE_BUTTON_MIDDLE, 249 | )), 250 | cursorX: cursorPosX[0], 251 | cursorY: cursorPosY[0], 252 | }; 253 | } 254 | 255 | dispatchEvent(event: Event) { 256 | return super.dispatchEvent(event) && window.dispatchEvent(event); 257 | } 258 | 259 | updateEvents() { 260 | const oldState = this.state; 261 | this.state = this.getCurrentState(); 262 | const changed: string[] = []; 263 | for (const prop in oldState) { 264 | if (oldState[prop] !== this.state[prop]) { 265 | changed.push(prop); 266 | } 267 | } 268 | 269 | const oldPointerDown = oldState.mouseButtonLeft || 270 | oldState.mouseButtonRight || 271 | oldState.mouseButtonMiddle; 272 | const newPointerDown = this.state.mouseButtonLeft || 273 | this.state.mouseButtonRight || 274 | this.state.mouseButtonMiddle; 275 | 276 | if (changed.includes("cursorX") || changed.includes("cursorY")) { 277 | const data = { 278 | clientX: this.state.cursorX, 279 | clientY: this.state.cursorY, 280 | pageX: this.state.cursorX, 281 | pageY: this.state.cursorY, 282 | }; 283 | this.dispatchEvent(Object.assign(new Event("pointermove"), data)); 284 | this.dispatchEvent(Object.assign(new Event("mousemove"), data)); 285 | } 286 | 287 | if (!oldPointerDown && newPointerDown) { 288 | const data = { 289 | clientX: this.state.cursorX, 290 | clientY: this.state.cursorY, 291 | pageX: this.state.cursorX, 292 | pageY: this.state.cursorY, 293 | button: this.state.mouseButtonLeft 294 | ? 0 295 | : this.state.mouseButtonMiddle 296 | ? 1 297 | : 2, 298 | }; 299 | this.dispatchEvent(Object.assign(new Event("pointerdown"), data)); 300 | this.dispatchEvent(Object.assign(new Event("mousedown"), data)); 301 | } 302 | 303 | if (oldPointerDown && !newPointerDown) { 304 | const data = { 305 | clientX: this.state.cursorX, 306 | clientY: this.state.cursorY, 307 | pageX: this.state.cursorX, 308 | pageY: this.state.cursorY, 309 | button: !this.state.mouseButtonLeft 310 | ? 0 311 | : !this.state.mouseButtonMiddle 312 | ? 1 313 | : 2, 314 | }; 315 | this.dispatchEvent(Object.assign(new Event("pointerup"), data)); 316 | this.dispatchEvent(Object.assign(new Event("mouseup"), data)); 317 | } 318 | 319 | ["keyW", "keyA", "keyS", "keyD"].forEach((key) => { 320 | if (!changed.includes(key)) return; 321 | if (this.state[key]) { 322 | const data = { 323 | code: key[0].toUpperCase() + key.slice(1), 324 | }; 325 | this.dispatchEvent(Object.assign(new Event("keydown"), data)); 326 | } else { 327 | const data = { 328 | code: key[0].toUpperCase() + key.slice(1), 329 | }; 330 | this.dispatchEvent(Object.assign(new Event("keyup"), data)); 331 | } 332 | }); 333 | } 334 | 335 | [Symbol.for("Deno.customInspect")]() { 336 | return `Canvas {}`; 337 | } 338 | } 339 | -------------------------------------------------------------------------------- /src/web/document.ts: -------------------------------------------------------------------------------- 1 | import { Canvas } from "./canvas.ts"; 2 | import { HTMLElement } from "./element.ts"; 3 | import { Image } from "./image.ts"; 4 | 5 | export class DocumentBody extends HTMLElement {} 6 | 7 | export class DocumentElement extends HTMLElement {} 8 | 9 | export class FakeDocument extends EventTarget { 10 | documentElement = new DocumentElement(); 11 | body = new DocumentBody(); 12 | 13 | createElement(tagName: string) { 14 | if (tagName === "img") { 15 | return new Image(); 16 | } else if (tagName === "canvas") { 17 | return new Canvas({ 18 | title: "GLFW Canvas", 19 | width: (globalThis as any)._width ?? 800, 20 | height: (globalThis as any)._height ?? 600, 21 | visible: !(globalThis as any).HEADLESS, 22 | }); 23 | } else { 24 | return new HTMLElement(); 25 | } 26 | } 27 | 28 | createElementNS(_namespace: string, tagName: string) { 29 | return this.createElement(tagName); 30 | } 31 | 32 | getElementById(_id: string) { 33 | return new HTMLElement(); 34 | } 35 | 36 | getElementsByTagName(_tagName: string) { 37 | return []; 38 | } 39 | 40 | createTextNode(_text: string) { 41 | return new HTMLElement(); 42 | } 43 | } 44 | 45 | export const document = new FakeDocument(); 46 | 47 | declare global { 48 | interface globalThis { 49 | document: typeof document; 50 | } 51 | } 52 | 53 | Object.defineProperty(globalThis, "document", { 54 | value: document, 55 | writable: false, 56 | }); 57 | -------------------------------------------------------------------------------- /src/web/element.ts: -------------------------------------------------------------------------------- 1 | import type { FakeDocument } from "./document.ts"; 2 | 3 | export class Element extends EventTarget { 4 | clientTop = 0; 5 | clientLeft = 0; 6 | children = []; 7 | offsetLeft = 0; 8 | offsetTop = 0; 9 | 10 | focus() {} 11 | 12 | get ownerDocument(): FakeDocument { 13 | return (globalThis as unknown as { document: FakeDocument }).document; 14 | } 15 | 16 | appendChild(element: Element) { 17 | // if (element.constructor.name === "Canvas") { 18 | // (element as Canvas).show(); 19 | // } 20 | } 21 | } 22 | 23 | export class HTMLElement extends Element { 24 | style: Record = {}; 25 | 26 | get title() { 27 | return ""; 28 | } 29 | set title(_value: string) {} 30 | 31 | setPointerCapture() {} 32 | releasePointerCapture() {} 33 | } 34 | 35 | Object.defineProperty(globalThis, "HTMLElement", { 36 | value: HTMLElement, 37 | writable: false, 38 | }); 39 | 40 | Object.defineProperty(globalThis, "Element", { 41 | value: Element, 42 | writable: false, 43 | }); 44 | -------------------------------------------------------------------------------- /src/web/ext/angle_instance_arrays.ts: -------------------------------------------------------------------------------- 1 | export class ANGLEInstanceArrays { 2 | VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE = 35070; 3 | 4 | drawArraysInstancedANGLE() {} 5 | 6 | drawElementsInstancedANGLE() {} 7 | 8 | vertexAttribDivisorANGLE() {} 9 | } 10 | -------------------------------------------------------------------------------- /src/web/ext/ext_blend_minmax.ts: -------------------------------------------------------------------------------- 1 | export class EXTBlendMinmax { 2 | MIN_EXT = 32775; 3 | MAX_EXT = 32776; 4 | } 5 | -------------------------------------------------------------------------------- /src/web/ext/ext_color_buffer_float.ts: -------------------------------------------------------------------------------- 1 | export class EXTColorBufferFloat { 2 | RGBA32F_EXT = 34836; 3 | RGB32F_EXT = 34837; 4 | FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT = 33297; 5 | UNSIGNED_NORMALIZED_EXT = 35863; 6 | } 7 | -------------------------------------------------------------------------------- /src/web/ext/ext_color_buffer_half_float.ts: -------------------------------------------------------------------------------- 1 | export class EXTColorBufferHalfFloat { 2 | RGBA16F_EXT = 34842; 3 | RGB16F_EXT = 34843; 4 | FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT = 33297; 5 | UNSIGNED_NORMALIZED_EXT = 35863; 6 | } 7 | -------------------------------------------------------------------------------- /src/web/ext/ext_disjoint_timer_query.ts: -------------------------------------------------------------------------------- 1 | export class EXTDisjointTimerQuery { 2 | QUERY_COUNTER_BITS_EXT = 0x8864; 3 | CURRENT_QUERY_EXT = 0x8865; 4 | QUERY_RESULT_EXT = 0x8866; 5 | QUERY_RESULT_AVAILABLE_EXT = 0x8867; 6 | TIME_ELAPSED_EXT = 0x88BF; 7 | TIMESTAMP_EXT = 0x8E28; 8 | GPU_DISJOINT_EXT = 0x8FBB; 9 | } 10 | -------------------------------------------------------------------------------- /src/web/ext/ext_float_blend.ts: -------------------------------------------------------------------------------- 1 | export class EXTFloatBlend {} 2 | -------------------------------------------------------------------------------- /src/web/ext/ext_frag_depth.ts: -------------------------------------------------------------------------------- 1 | export class EXTFragDepth {} 2 | -------------------------------------------------------------------------------- /src/web/ext/ext_shader_texture_lod.ts: -------------------------------------------------------------------------------- 1 | export class EXTShaderTextureLod {} 2 | -------------------------------------------------------------------------------- /src/web/ext/ext_srgb.ts: -------------------------------------------------------------------------------- 1 | export class EXTSRGB { 2 | SRGB_EXT = 0x8C40; 3 | SRGB_ALPHA_EXT = 0x8C42; 4 | SRGB8_ALPHA8_EXT = 0x8C43; 5 | FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT = 0x8210; 6 | } 7 | -------------------------------------------------------------------------------- /src/web/ext/ext_texture_filter_anisotropic.ts: -------------------------------------------------------------------------------- 1 | export class EXTTextureFilterAnisotropic { 2 | TEXTURE_MAX_ANISOTROPY_EXT = 0x84FE; 3 | MAX_TEXTURE_MAX_ANISOTROPY_EXT = 0x84FF; 4 | } 5 | -------------------------------------------------------------------------------- /src/web/ext/khr_parallel_shader_compile.ts: -------------------------------------------------------------------------------- 1 | export class KHRParallelShaderCompile { 2 | COMPLETION_STATUS_KHR = 0x91B1; 3 | MAX_SHADER_COMPILER_THREADS_KHR = 0x91B0; 4 | } 5 | -------------------------------------------------------------------------------- /src/web/ext/mod.ts: -------------------------------------------------------------------------------- 1 | import { ANGLEInstanceArrays } from "./angle_instance_arrays.ts"; 2 | import { EXTBlendMinmax } from "./ext_blend_minmax.ts"; 3 | import { EXTColorBufferFloat } from "./ext_color_buffer_float.ts"; 4 | import { EXTColorBufferHalfFloat } from "./ext_color_buffer_half_float.ts"; 5 | import { EXTDisjointTimerQuery } from "./ext_disjoint_timer_query.ts"; 6 | import { EXTFloatBlend } from "./ext_float_blend.ts"; 7 | import { EXTFragDepth } from "./ext_frag_depth.ts"; 8 | import { EXTShaderTextureLod } from "./ext_shader_texture_lod.ts"; 9 | import { EXTSRGB } from "./ext_srgb.ts"; 10 | import { EXTTextureFilterAnisotropic } from "./ext_texture_filter_anisotropic.ts"; 11 | import { KHRParallelShaderCompile } from "./khr_parallel_shader_compile.ts"; 12 | import { OESTextureFloatLinear } from "./oes_texture_float_linear.ts"; 13 | import { OESTextureHalfFloat } from "./oes_texture_half_float.ts"; 14 | 15 | export const extensions = { 16 | ANGLE_instanced_arrays: ANGLEInstanceArrays, 17 | EXT_blend_minmax: EXTBlendMinmax, 18 | EXT_color_buffer_float: EXTColorBufferFloat, 19 | EXT_color_buffer_half_float: EXTColorBufferHalfFloat, 20 | EXT_disjoint_timer_query: EXTDisjointTimerQuery, 21 | EXT_float_blend: EXTFloatBlend, 22 | EXT_frag_depth: EXTFragDepth, 23 | EXT_shader_texture_lod: EXTShaderTextureLod, 24 | EXT_sRGB: EXTSRGB, 25 | OES_texture_half_float: OESTextureHalfFloat, 26 | OES_texture_float_linear: OESTextureFloatLinear, 27 | EXT_texture_filter_anisotropic: EXTTextureFilterAnisotropic, 28 | KHR_parallel_shader_compile: KHRParallelShaderCompile, 29 | }; 30 | -------------------------------------------------------------------------------- /src/web/ext/oes_texture_float_linear.ts: -------------------------------------------------------------------------------- 1 | export class OESTextureFloatLinear {} 2 | -------------------------------------------------------------------------------- /src/web/ext/oes_texture_half_float.ts: -------------------------------------------------------------------------------- 1 | export class OESTextureHalfFloat { 2 | HALF_FLOAT_OES = 0x8D61; 3 | } 4 | -------------------------------------------------------------------------------- /src/web/image.ts: -------------------------------------------------------------------------------- 1 | import * as JPEG from "https://deno.land/x/jpegts@1.1/mod.ts"; 2 | import * as PNG from "https://deno.land/x/pngs@0.1.1/mod.ts"; 3 | import { HTMLElement } from "./element.ts"; 4 | 5 | function pngDecode(data: Uint8Array) { 6 | const result = PNG.decode(data); 7 | if (result.colorType === PNG.ColorType.RGB) { 8 | // convert to RGBA. 9 | const rgba = new Uint8Array(result.width * result.height * 4); 10 | for (let i = 0; i < result.width * result.height; i++) { 11 | const rgbi = i * 3; 12 | const rgbai = i * 4; 13 | rgba.set([ 14 | result.image[rgbi], 15 | result.image[rgbi + 1], 16 | result.image[rgbi + 2], 17 | 255, 18 | ], rgbai); 19 | } 20 | return { data: rgba, width: result.width, height: result.height }; 21 | } else if (result.colorType === PNG.ColorType.RGBA) { 22 | return { data: result.image, width: result.width, height: result.height }; 23 | } else { 24 | throw new Error("Unsupported color type: " + result.colorType); 25 | } 26 | } 27 | 28 | export class Image extends HTMLElement { 29 | #src = ""; 30 | #width = 0; 31 | #height = 0; 32 | #data = new Uint8Array(0); 33 | 34 | get width() { 35 | return this.#width; 36 | } 37 | 38 | get height() { 39 | return this.#height; 40 | } 41 | 42 | get src() { 43 | return this.#src; 44 | } 45 | 46 | set src(src) { 47 | this.#src = src; 48 | console.log(`[loader] Loading image ${src}`); 49 | fetch(src) 50 | .then((res) => res.arrayBuffer()) 51 | .then((buffer) => { 52 | const u8 = new Uint8Array(buffer); 53 | // hack 54 | const img = src.endsWith(".png") ? pngDecode(u8) : JPEG.decode(u8); 55 | this.#width = img.width; 56 | this.#height = img.height; 57 | this.#data = img.data; 58 | console.log( 59 | `[loader] Loaded image ${src}: ${this.#width}x${this.#height}`, 60 | ); 61 | this.dispatchEvent(new Event("load", { cancelable: false })); 62 | }) 63 | .catch((e) => { 64 | console.error(`[loader] Failed to load image ${src}: ${e}`); 65 | this.dispatchEvent(new Event("error", { cancelable: false })); 66 | }); 67 | } 68 | 69 | // Non-standard. 70 | get rawData() { 71 | return this.#data; 72 | } 73 | 74 | set onload(callback: EventListenerOrEventListenerObject) { 75 | this.addEventListener("load", callback); 76 | } 77 | 78 | set onerror(callback: EventListenerOrEventListenerObject) { 79 | this.addEventListener("error", callback); 80 | } 81 | 82 | [Symbol.for("Deno.customInspect")]() { 83 | return `Image ${ 84 | this.#data ? `<${this.width}x${this.height}>` : "" 85 | } { ${this.src} }`; 86 | } 87 | } 88 | 89 | Object.defineProperty(window, "Image", { 90 | value: Image, 91 | }); 92 | -------------------------------------------------------------------------------- /src/web/mod.ts: -------------------------------------------------------------------------------- 1 | export * from "./animation.ts"; 2 | export * from "./document.ts"; 3 | export * from "./element.ts"; 4 | export * from "./image.ts"; 5 | export * from "./canvas.ts"; 6 | export * from "./context.ts"; 7 | -------------------------------------------------------------------------------- /src/web/webgl_object.ts: -------------------------------------------------------------------------------- 1 | export const _name = Symbol("[[glObjectName]]"); 2 | export const _invalidated = Symbol("[[invalidated]]"); 3 | 4 | const cache = new Map(); 5 | 6 | export class WebGLObject { 7 | [_name]: number; 8 | [_invalidated]: boolean = false; 9 | 10 | constructor(name: number) { 11 | this[_name] = name; 12 | if (name === 0) { 13 | console.log("warn: GL object created with zero name"); 14 | } 15 | } 16 | 17 | static make(name: number) { 18 | if (cache.has(name)) { 19 | return cache.get(name)!; 20 | } else { 21 | const obj = new this(name); 22 | cache.set(name, obj); 23 | return obj; 24 | } 25 | } 26 | 27 | toString() { 28 | return `WebGLObject(${this[_name]})`; 29 | } 30 | 31 | [Symbol.for("Deno.customInspect")]() { 32 | return this.toString(); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /tools/cts_runner.ts: -------------------------------------------------------------------------------- 1 | import { DOMParser } from "https://deno.land/x/deno_dom@v0.1.21-alpha/deno-dom-wasm.ts"; 2 | 3 | const CTS_PATH = new URL( 4 | "../WebGL/conformance-suites/2.0.0/conformance2/00_test_list.txt", 5 | import.meta.url, 6 | ); 7 | 8 | const DENO_GL_IMPORT = new URL("../mod.ts", import.meta.url).toString(); 9 | 10 | async function* getTests(path: URL): AsyncIterableIterator { 11 | const testList = await Deno.readTextFile(path); 12 | for (const line of testList.replaceAll("\r\n", "\n").split("\n")) { 13 | if (line.startsWith("//")) continue; 14 | const entry = line.split(" ").pop()!; 15 | if (entry.endsWith(".txt")) { 16 | for await (const url of getTests(new URL("./" + entry, path))) { 17 | yield url; 18 | } 19 | } else if (entry.endsWith(".html")) { 20 | yield new URL("./" + entry, path); 21 | } 22 | } 23 | } 24 | 25 | function cov(total: number, passed: number, failed: number, skipped: number) { 26 | return `${passed}/${total} passed, ${failed} failed, ${skipped} skipped, ${((passed / total) * 100).toFixed(2)}% coverage`; 27 | } 28 | 29 | const groups = new Map>(); 30 | 31 | for await (const test of getTests(CTS_PATH)) { 32 | let name = test.href.split("conformance2/").pop()!; 33 | name = name.substring(0, name.length - 5); 34 | 35 | const [groupName, ...parts] = name.split("/"); 36 | const group = groups.get(groupName) ?? new Set(); 37 | group.add([parts.join("/"), test]); 38 | groups.set(groupName, group); 39 | } 40 | 41 | const parser = new DOMParser(); 42 | const importCache = new Map(); 43 | 44 | async function tryImport(url: URL) { 45 | const exists = importCache.get(url.toString()); 46 | if (exists) return exists; 47 | const code = await Deno.readTextFile(url); 48 | importCache.set(url.toString(), code); 49 | return code; 50 | } 51 | 52 | await Deno.remove(new URL("./test", import.meta.url), { recursive: true }) 53 | .catch(() => {}); 54 | await Deno.mkdir(new URL("./test", import.meta.url)); 55 | 56 | const GREEN = "#0DBC79"; 57 | 58 | let total = 0; 59 | let passed = 0; 60 | let failed = 0; 61 | let skipped = 0; 62 | 63 | for (const [group, tests] of groups) { 64 | if (Deno.args.length !== 0 && !Deno.args.includes(group)) { 65 | continue; 66 | } 67 | 68 | let groupTotal = 0; 69 | let groupPassed = 0; 70 | let groupFailed = 0; 71 | let groupSkipped = 0; 72 | 73 | console.log(`%cgroup %c${group}`, `color: ${GREEN}`, ""); 74 | for (const [name, url] of tests) { 75 | console.log(` %ctest %c${name}`, `color: ${GREEN}`, ""); 76 | const html = await Deno.readTextFile(url); 77 | const document = parser.parseFromString(html, "text/html")!; 78 | let code = "// NOTE: Auto-generated by Deno GL CTS runner\n\n"; 79 | 80 | code += `import "${DENO_GL_IMPORT}";\n`; 81 | code += `import "https://deno.land/x/xhr@0.1.2/mod.ts";\n\n`; 82 | 83 | code += `globalThis.LOCATION = new URL(${JSON.stringify(url.href)});\n`; 84 | code += `globalThis.HEADLESS = true;\n`; 85 | code += `globalThis.PASSED = 0;\n`; 86 | code += `globalThis.FAILED = 0;\n`; 87 | code += `globalThis.SKIPPED = 0;\n`; 88 | code += `globalThis.GLSLConformanceTester = {};\n`; 89 | code += `globalThis.successfullyParsed = true;\n`; 90 | code += `globalThis.sourceSubRectangleString = "";\n`; 91 | code += "globalThis.parent = {};\n"; 92 | code += `globalThis.parent.webglTestHarness = {};\n`; 93 | code += 94 | `globalThis.parent.webglTestHarness.reportResults = (path, success, msg, skipped = false) => {\n`; 95 | code += ` if (skipped) {\n`; 96 | code += ` globalThis.SKIPPED++;\n`; 97 | code += ` // console.log("skipped", path);\n`; 98 | code += ` } else if (success) {\n`; 99 | code += ` // console.log("passed", path);\n`; 100 | code += ` globalThis.PASSED++;\n`; 101 | code += ` } else {\n`; 102 | code += ` globalThis.FAILED++;\n`; 103 | code += ` }\n`; 104 | code += "};\n"; 105 | code += `globalThis.parent.webglTestHarness.notifyFinished = (path) => {\n`; 106 | code += ` console.log("finished ... " + (${cov})(PASSED + FAILED + SKIPPED, PASSED, FAILED, SKIPPED));\n`; 107 | code += "};\n"; 108 | code += `document.getElementsByTagName = (tagName) => {\n`; 109 | code += ` if (tagName.toLowerCase() == "script") {\n`; 110 | code += ` return globalThis.CTS_SHADERS;\n`; 111 | code += ` }\n`; 112 | code += ` return [];\n`; 113 | code += "};\n"; 114 | code += "\n"; 115 | 116 | const shaders = new Map(); 120 | const scripts = new Map(); 121 | 122 | let anonID = 0; 123 | 124 | for (const node of document.getElementsByTagName("script")) { 125 | const src = node.getAttribute("src"); 126 | const type = node.getAttribute("type"); 127 | 128 | if (type?.startsWith("x-shader")) { 129 | shaders.set(node.id, { 130 | type: type!, 131 | source: node.textContent, 132 | }); 133 | } else if (src) { 134 | const srcUrl = new URL(src, url); 135 | scripts.set(srcUrl.toString(), await tryImport(srcUrl)); 136 | } else { 137 | scripts.set("anon-script-tag-" + anonID, node.textContent); 138 | anonID++; 139 | } 140 | } 141 | 142 | const canvas = document.getElementsByTagName("canvas")[0]; 143 | if (canvas) { 144 | code += "\n"; 145 | code += `window._width = ${canvas.getAttribute("width")?.replaceAll("px", "")};\n`; 146 | code += `window._height = ${canvas.getAttribute("height")?.replaceAll("px", "")};\n`; 147 | code += "\n"; 148 | } 149 | 150 | code += "//#region Shaders\n\n"; 151 | 152 | code += "globalThis.CTS_SHADERS = [];\n\n"; 153 | 154 | for (const [name, shader] of shaders) { 155 | code += `CTS_SHADERS.push({\n`; 156 | code += ` name: ${JSON.stringify(name)},\n`; 157 | code += ` type: "${shader.type}",\n`; 158 | code += ` src: "",\n`; 159 | code += ` text: ` + JSON.stringify(shader.source) + `,\n`; 160 | code += "});\n\n"; 161 | } 162 | 163 | code += "//#endregion\n\n"; 164 | 165 | for (const [path, source] of scripts) { 166 | code += `//#region Script: ${path}\n\n`; 167 | code += source.trim(); 168 | code += `\n\n//#endregion\n\n`; 169 | } 170 | 171 | code = code.trim() + "\n"; 172 | 173 | code = code.replaceAll("\n}());\n", "\n}).bind(globalThis)();\n"); 174 | code = code.replaceAll("window.location", "globalThis.LOCATION"); 175 | code = code.replaceAll( 176 | `opt_canvas = opt_canvas || document.createElement("canvas");`, 177 | `opt_canvas = document.createElement("canvas");`, 178 | ); 179 | code = code.replaceAll("\nTestEval = function(str) {", "\nvar TestEval = function(str) {"); 180 | code = code.replaceAll( 181 | "var readFile = function(file) {", 182 | `var readFile = function(file) { 183 | if (file.startsWith("undefined")) { 184 | file = file.slice(9); 185 | file = new URL(file, new URL(${JSON.stringify(new URL("../WebGL/conformance-suites/2.0.0/", import.meta.url))})); 186 | } 187 | return Deno.readTextFileSync(file).replaceAll("\\r", "");`, 188 | ); 189 | code = code.replaceAll( 190 | `var shaderScript = document.getElementById(scriptId);`, 191 | `var shaderScript = scriptId.includes("void main") ? {text:scriptId} : globalThis.CTS_SHADERS.find(e => e.name === scriptId || e.text === scriptId);`, 192 | ); 193 | 194 | const codeURL = new URL("./test/" + name.replaceAll("/", "_") + ".js", import.meta.url); 195 | await Deno.writeTextFile( 196 | codeURL, 197 | code, 198 | ); 199 | 200 | const result = Deno.run({ 201 | cmd: [ 202 | "deno", 203 | "run", 204 | "-A", 205 | "--unstable", 206 | "--no-check", 207 | codeURL.toString(), 208 | ], 209 | stdin: "null", 210 | stdout: "piped", 211 | stderr: "piped", 212 | }); 213 | 214 | const [status, output, stderrOutput] = await Promise.all([result.status(), result.output(), result.stderrOutput()]); 215 | 216 | const stdout = new TextDecoder().decode(output).trim().replaceAll("\r\n", "\n").split("\n").filter(e => e !== ""); 217 | const stderr = new TextDecoder().decode(stderrOutput).trim().replaceAll("\r\n", "\n").split("\n").filter(e => e !== ""); 218 | 219 | result.close(); 220 | 221 | if (stdout.length) { 222 | console.log(stdout.map(e => " " + e).join("\n")); 223 | } 224 | 225 | if (stderr.length) { 226 | console.log(stderr.map(e => " " + e).join("\n")); 227 | } 228 | 229 | const finished = stdout.find(e => e.trim().startsWith("finished")); 230 | 231 | if (finished) { 232 | const [, passed, failed, skipped] = finished.match(/(\d+) passed, (\d+) failed, (\d+) skipped/)!.map(e => parseInt(e)); 233 | 234 | groupTotal += passed + failed + skipped; 235 | groupPassed += passed; 236 | groupFailed += failed; 237 | groupSkipped += skipped; 238 | } else { 239 | console.log(` error: test didn't finish (code: ${status.code})`); 240 | } 241 | } 242 | 243 | console.log(" group finished ... " + cov(groupTotal, groupPassed, groupFailed, groupSkipped)); 244 | 245 | total += groupTotal; 246 | passed += groupPassed; 247 | failed += groupFailed; 248 | skipped += groupSkipped; 249 | } 250 | 251 | console.log("cts finished ... " + cov(total, passed, failed, skipped)); 252 | --------------------------------------------------------------------------------