google / node-gles

Apache License 2.0
323 stars 32 forks source link

Error: Unsupported getParameter() option #37

Open kbruneel opened 5 years ago

kbruneel commented 5 years ago

I'm trying to use node-gles with three.js and get the following error: Error: Unsupported getParameter() option

I guess get Parameter is not implemented yet?

When do you think it's realistic for me to try my three.js experiment again?

nkreeger commented 5 years ago

Looks like this is resolved from https://github.com/google/node-gles/issues/34 ?

kbruneel commented 5 years ago

No this is something else.

nkreeger commented 5 years ago

OK - I'll need some more details here. Stack trace, what was the argument passed into getParameter etc.

AlexVestin commented 5 years ago

I ran in to the same problem trying to use this project with three.js

        var maxVertexTextures = gl.getParameter( gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS );
                                   ^

Error: Unsupported getParameter() option
    at new WebGLCapabilities (/home/gaz/prog/native-threejs/node_modules/three/build/three.js:15851:30)
    at initGLContext (/home/gaz/prog/native-threejs/node_modules/three/build/three.js:23321:19)
    at new WebGLRenderer (/home/gaz/prog/native-threejs/node_modules/three/build/three.js:23370:3)
    at Object.<anonymous> (/home/gaz/prog/native-threejs/main.js:16:16)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)

at this location in the library: https://github.com/mrdoob/three.js/blob/c4b7b422b3f17900e530d27e3bbf0cdd76200cc1/src/renderers/webgl/WebGLCapabilities.js#L73

I commented out some to see which would work and

gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS
gl.MAX_CUBE_MAP_TEXTURE_SIZE
gl.MAX_VERTEX_ATTRIBS
gl.MAX_VERTEX_UNIFORM_VECTORS
gl.MAX_VARYING_VECTORS
gl.MAX_FRAGMENT_UNIFORM_VECTORS

threw errors when called with gl.getParameter

AlexVestin commented 5 years ago

Guessing they need to have cases here: https://github.com/google/node-gles/blob/f1e76c5ec756449f1cde91891b6c6c8afc2e01be/binding/webgl_rendering_context.cc#L2539

edit: I created a pull request at #47

Next thing is that ANGLE_instanced_arrays is not implemented, which makes the code fail

nkreeger commented 5 years ago

Hi @AlexVestin yeah we can change that block to not fail if the param is not implemented. It should be as easy as matching up context values.

I'll try and take a look this week at this. I'm behind on getting a new build out.

Molay commented 5 years ago

Hi @nkreeger , is it still not supported for the parameters of extensions?

const ext = gl.getExtension('WEBGL_debug_renderer_info');
if (ext != null) {
  const rendererInfo = gl.getParameter(ext.UNMASKED_RENDERER_WEBGL);
  const vendorInfo = gl.getParameter(ext.UNMASKED_VENDOR_WEBGL);
  console.log(rendererInfo, vendorInfo);
}
nkreeger commented 5 years ago

Params are supported - however those params are not implemented: https://github.com/google/node-gles/blob/master/binding/webgl_rendering_context.cc#L2625

That block can probably be changed to not throw an exception. For node-gles - I'd recommend asking renderer info like so: https://github.com/google/node-gles/blob/master/src/tests/float_texture_upload_test.ts#L11

Molay commented 5 years ago

Hi @nkreeger . Unfortunately, there are some useful extension parameters that are not supported, such as EXT_texture_filter_anisotropic.

Could you extend the getParameter method more compatibly? It is very much appreciated.

nkreeger commented 5 years ago

I just published 0.0.16 which has a fix for exception throwing with implemented extension support - https://github.com/google/node-gles/pull/57

Thanks @rnconrad!