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

[BUG] Can't get gl.VERSION correctly. #13210

Closed
finscn opened this issue Jan 31, 2018 · 7 comments
Closed

[BUG] Can't get gl.VERSION correctly. #13210

finscn opened this issue Jan 31, 2018 · 7 comments

Comments

@finscn
Copy link
Contributor

finscn commented Jan 31, 2018

var version = parseFloat( /^WebGL\ ([0-9])/.exec( gl.getParameter( gl.VERSION ) )[ 1 ] );

on some android platforms , the code

/^WebGL\ ([0-9])/.exec( gl.getParameter( gl.VERSION ) )

will return null (because there is no WebGL, only OpenGL ES),
so , this line will take an error Cannot read '1' of null.

Suggestion :

change to

var version = /^WebGL\ ([0-9])/.exec( gl.getParameter( gl.VERSION ) );
version = version ? parseFloat(  version[ 1 ] ) : 1.0; 
@eastecho
Copy link

Same here.

I'm running three.js with WeChat platform, the same problem occured.

@Mugen87
Copy link
Collaborator

Mugen87 commented Jan 31, 2018

(because there is no WebGL, only OpenGL ES)

Does that mean you are not using three.js in a browser but in a WebView or something?

@finscn
Copy link
Contributor Author

finscn commented Jan 31, 2018

@Mugen87 , in browser , but it's the built-in browser of custom ROM .
In China , there are many custom ROMs in different android phones.

@Mugen87
Copy link
Collaborator

Mugen87 commented Jan 31, 2018

I'm curious how these browsers internally work 🤔. They have a WebGL API but no WebGL implementation?

@finscn
Copy link
Contributor Author

finscn commented Jan 31, 2018

@Mugen87 , they could run many webgl app , just information of gl.VERSION is incorrect.
So magic ...

@Mugen87
Copy link
Collaborator

Mugen87 commented Jan 31, 2018

I've realized that there is already a PR for introducing OpenGL ES support: #13046

@finscn Can you please check what's different compared to your PR? I think one PR that tackles the issue is sufficient.

@finscn
Copy link
Contributor Author

finscn commented Jan 31, 2018

@Mugen87 , I read the #13046 , and it inspires me.
I've updated my PR.
Now , I think my PR #13211 is better than #13046.
Whatever , thanks , @raindust .

@mrdoob mrdoob closed this as completed Jan 31, 2018
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

4 participants