-
-
Notifications
You must be signed in to change notification settings - Fork 36.2k
Add webgl2 message on Detector #14504
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
Conversation
examples/webgl2_sandbox.html
Outdated
|
|
||
| // | ||
|
|
||
| if ( ! Detector.webgl2 ) Detector.addGetWebGLMessage( { version: 'webgl2' }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I would add Detector.addGetWebGL2Message() instead in order to avoid the parameter object.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Mugen87 @mrdoob what do you think about adding a addGetWebGLMessageByVersion to avoid duplicating code?
addGetWebGLMessageByVersion: function ( parameters, version ) {
var parent, id, element;
parameters = parameters || {};
parent = parameters.parent !== undefined ? parameters.parent : document.body;
id = parameters.id !== undefined ? parameters.id : 'oldie';
element = Detector.getWebGLErrorMessage( version );
element.id = id;
parent.appendChild( element );
},
addGetWebGL2Message: function ( parameters ) {
Detector.addGetWebGLMessageByVersion( parameters, 'webgl2' );
},
addGetWebGLMessage: function ( parameters ) {
Detector.addGetWebGLMessageByVersion( parameters, 'webgl' );
}Do you think we should do something similar with Detector.getWebGLErrorMessage/getWebGL2ErrorMessage ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what do you think about adding a addGetWebGLMessageByVersion to avoid duplicating code?
I think that's fine. But I would name it _addGetWebGLMessageByVersion() or make a function instead (and move the whole code into a closure).
Do you think we should do something similar with Detector.getWebGLErrorMessage/getWebGL2ErrorMessage ?
If it makes the code easier to read, why not? 😊
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
|
/friendly-ping @mrdoob |
|
Ended up refactoring Detector.js completely. #14967 |
Modified the
Detector.addGetWebGLMessageso you could pass{version: 'webgl2'}and it will create the correct message and link to https://get.webgl.org/webgl2