Skip to content

Commit

Permalink
Fix texImage2D
Browse files Browse the repository at this point in the history
  • Loading branch information
raub committed May 8, 2021
1 parent ee0a391 commit bf2cbca
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
10 changes: 4 additions & 6 deletions js/webgl.js
Original file line number Diff line number Diff line change
Expand Up @@ -251,11 +251,10 @@ const _bindTexture = gl.bindTexture;
gl.bindTexture = (target, texture) => _bindTexture(target, enforceId(texture));

const _texImage2D = gl.texImage2D;
gl.texImage2D = (
target, level, internalformat, width, height, border, format, type, pixels
) => {
gl.texImage2D = (...args) => {
const [target, level, internalformat, width, height, border, format, type, pixels] = args;

if (arguments.length === 6) {
if (args.length === 6) {
// width is now format, height is now type, and border is now pixels
pixels = border;
type = height;
Expand All @@ -265,12 +264,11 @@ gl.texImage2D = (
);
}

if (arguments.length === 9) {
if (args.length === 9) {
return _texImage2D(target, level, internalformat, width, height, border, format, type, pixels);
}

throw new TypeError('Function texImage2D() takes 6 or 9 arguments.');

};


Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"author": "Luis Blanco <[email protected]>",
"name": "webgl-raub",
"version": "2.2.1",
"version": "2.2.2",
"description": "WebGL for Node.js",
"license": "MIT",
"main": "index.js",
Expand Down

0 comments on commit bf2cbca

Please sign in to comment.