问题
I know that we can specify attributes for a WebGL context when we create the context:
var ctx = myCanvas.getContext(‘webgl’, attributes);
Is there a method that we can call to set the attributes of ctx after ctx has been created? For instance, can we do something akin to
var ctx = myCanvas.getContext(‘webgl’);
ctx.setAttributes(attributes);
回答1:
That would require being able to change the attributes of a context. Which you're not allowed to do. They're fixed at context creation time.
回答2:
here it is:context.getContextAttributes()
来源:https://stackoverflow.com/questions/17153833/how-do-i-set-the-attributes-of-a-webgl-context-after-it-has-been-created