Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error displaying Depth Texture sample on WebGL 2 compatible browser #10672

Closed
5 of 12 tasks
cx20 opened this issue Jan 27, 2017 · 8 comments
Closed
5 of 12 tasks

Error displaying Depth Texture sample on WebGL 2 compatible browser #10672

cx20 opened this issue Jan 27, 2017 · 8 comments

Comments

@cx20
Copy link
Contributor

cx20 commented Jan 27, 2017

Description of the problem

I tried to display the following sample on the WebGL 2 compatible browser (Chrome 56 and Firefox 51), but an error was displayed.
https://threejs.org/examples/webgl_depth_texture.html

Your browser does not support WEBGL_depth_texture.
This demo will not work.

When you disable WebGL 2, samples are displayed.

Is it a problem of sample check processing?

Three.js version
  • Dev
  • r84
  • ...
Browser
  • All of them
  • Chrome 56
  • Firefox 51
  • Internet Explorer
OS
  • All of them
  • Windows
  • Linux
  • Android
  • IOS
Hardware Requirements (graphics card, VR Device, ...)

ThinkPad X260 + Intel(R) HD Graphics 520

@takahirox
Copy link
Collaborator

takahirox commented Jan 27, 2017

We need to update WebGLExtensions for 2.0

case 'WEBGL_depth_texture':
	extension = gl.getExtension( 'WEBGL_depth_texture' ) || gl.getExtension( 'MOZ_WEBGL_depth_texture' ) || gl.getExtension( 'WEBKIT_WEBGL_depth_texture' );
	break;

extension = gl.getExtension( 'WEBGL_depth_texture' ) || gl.getExtension( 'MOZ_WEBGL_depth_texture' ) || gl.getExtension( 'WEBKIT_WEBGL_depth_texture' );

WebGL WEBGL_depth_texture Khronos Ratified Extension Specification
...
Dependencies
Written against the WebGL API 1.0 specification.
No longer available as of the WebGL API 2.0 specification.

https://www.khronos.org/registry/webgl/extensions/WEBGL_depth_texture/

@mrdoob
Will we add WebGLExtensions2,
have global value isWebGL2 to detect if the browser supports 2.0,
or anything else?

@mrdoob
Copy link
Owner

mrdoob commented Jan 27, 2017

Actually, I think we should remove all the isWebGL2 stuff from WebGLRenderer...

@takahirox
Copy link
Collaborator

Cool! Are we gonna get workable WebGL2Renderer in r85?

If not, I think we need a workaround to this issue so far.
It seems we can avoid this error by adding WebGL2 detection check here

if ( !renderer.extensions.get('WEBGL_depth_texture' && ! isWebGL2 ) ) {

if ( !renderer.extensions.get('WEBGL_depth_texture') ) {

@takahirox
Copy link
Collaborator

@mrdoob
Do you think we should add an workaround I mentioned so far?

@mrdoob
Copy link
Owner

mrdoob commented Feb 14, 2017

I'm confused... If the browser supports WebGL 2, WEBGL_depth_texture no longer works in WebGL1?

@takahirox
Copy link
Collaborator

takahirox commented Feb 14, 2017

To be more precise, depending not on the browser, but on context.

If we use webgl2 context WEBGL_depth_texture doesn't work and we can directly access gl.UNSIGNED_INT_24_8 while we access it via WEBGL_depth_texture extension in webgl1 context.

https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_depth_texture

gl = canvas.getContext('webgl2');

https://github.com/mrdoob/three.js/blob/dev/src/renderers/WebGLRenderer.js#L2895

@mrdoob
Copy link
Owner

mrdoob commented Feb 14, 2017

Ah! I see I see.

@mrdoob
Copy link
Owner

mrdoob commented Feb 14, 2017

Fixed!

@mrdoob mrdoob closed this as completed Feb 14, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants