From c561ef237cb3b66576b0e9e599f729628a209649 Mon Sep 17 00:00:00 2001 From: Mikola Lysenko Date: Fri, 22 Feb 2013 21:22:22 -0600 Subject: [PATCH] initialize --- README.md | 34 ++++++++++++++++++++++++++++++++++ webglew.js | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+) create mode 100644 README.md create mode 100644 webglew.js diff --git a/README.md b/README.md new file mode 100644 index 0000000..79edcd9 --- /dev/null +++ b/README.md @@ -0,0 +1,34 @@ +webglew +======= +*WebGL* *E*xtension *W*rangler. Manages WebGL extensions so you don't have to. + +Usage +===== +First, install using npm: + + npm install webglew + +Then you can pull in a list of extensions by passing it a WebGL context: + + var gl = require("gl"); + var ext = require("webglew")(gl); + + if(ext.OES_texture_float) { + console.log("GL context supports floats!"); + } else { + console.log("No floating point textures :'("); + } + +`require("webglew")(gl)` +------------------------ +To use the library, call the module with a WebGL context and it will return a JavaScript object with a list of properties. For convenience, extensions with a vendor specific prefix are aliased to the root WEBGL_* name. For example, + + WEBKIT_WEBGL_lose_context + +Becomes: + + WEBGL_lose_context + +Credits +======= +(c) 2013 Mikola Lysenko. BSD \ No newline at end of file diff --git a/webglew.js b/webglew.js new file mode 100644 index 0000000..b610e77 --- /dev/null +++ b/webglew.js @@ -0,0 +1,35 @@ +"use strict"; + +var VENDOR_PREFIX = [ + "WEBKIT_", + "MOZ_" +]; + +function baseName(ext_name) { + for(var i=0; i