11:30:34.395 [object WebGLExtensionDepthTexture] swaag.js:592311:30:35.146 "ignoring setsockopt command" swaag.js:767211:30:35.103 Error: WebGL: texImage2D: with format of DEPTH_COMPONENT or DEPTH_STENCIL target must be TEXTURE_2D, data must be nullptr, level must be zero
char req[] ="var ctx = Module.canvas.getContext('experimental-webgl');\n"
"var wk_dt = ctx.getExtension('WEBKIT_WEBGL_depth_texture');\n""var mz_dt = ctx.getExtension('MOZ_WEBGL_depth_texture');\n""console.log( wk_dt );\n""console.log( mz_dt );\n";emscripten_run_script(req);
After modifying the script a bit, I can see that MOZ_WEBGL_depth_texture is there.But the depth texture creation still fails.I found the console feature in firefox (I'm new to web dev) and saw this output:
11:30:34.395 [object WebGLExtensionDepthTexture] swaag.js:592311:30:35.146 "ignoring setsockopt command" swaag.js:767211:30:35.103 Error: WebGL: texImage2D: with format of DEPTH_COMPONENT or DEPTH_STENCIL target must be TEXTURE_2D, data must be nullptr, level must be zero
Modified script:
char req[] ="var ctx = Module.canvas.getContext('experimental-webgl');\n""var wk_dt = ctx.getExtension('WEBKIT_WEBGL_depth_texture');\n""var mz_dt = ctx.getExtension('MOZ_WEBGL_depth_texture');\n""console.log( wk_dt );\n""console.log( mz_dt );\n";emscripten_run_script(req);
I don't understand why it claims that data must be null pointer?I use this code on many different devices, yet WEBGL does not like it.
Because WEBGL_depth_texture
and ANGLE_depth_texture
on which it is based say
they do not support loading image data via the TexImage or
TexSubImage commands. They do not give a reason, which is in my
view a flaw in the ANGLE_depth_texture's issues list.
A couple of notes on the script: WEBGL_depth_texture has been a
ratified extension since 2013.05. There should be no need to use
WEBKIT and MOZ prefixes any more; Several browsers have passed
WebGL conformance so getContext('webgl') should be tried before
'webgl-experimental'.
Regards
-Mark
NOTE: This electronic mail message may contain confidential and privileged information from HI Corporation. If you are not the intended recipient, any disclosure, photocopying, distribution or use of the contents of the received information is prohibited. If you have received this e-mail in error, please notify the sender immediately and permanently delete this message and all related copies.
About webgl vs experimental-webgl:Error: WebGL: Retrieving a WebGL context from a canvas via a request id ('webgl') different from the id used to create the context ('experimental-webgl') is not allowed.
I suspected that might happen. Emscripten can't keep using
'experimental-webgl'. In theory it should go away but its
continued use, such as this by Emscripten, makes that difficult.
Emscripten should try 'webgl' first and only use
'experimental-webgl' if that fails. If Emscripten provides a way
for the app. to get the context it created, without needing to
call getContext, then it will not need to know which id was used
at creation.
--You received this message because you are subscribed to the Google Groups "emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-disc...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
It looks like emscripten currently looks for webgl-experimental and then tries webgl if the first failed.I don't understand the situation here though, what causes the two different ids? We just do canvas.getContext with the id once, I'm not sure where another id could get into the picture and cause confusion?
The OP added JS to enable the depth texture extension and that JS
is calling canvas.getContext(). Is there a better way to get the
context that Emscripten created?
--