-
Notifications
You must be signed in to change notification settings - Fork 140
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
Does this work with WebGLRenderingContext? #1
Comments
No idea |
totally does. SO AWESOME! sudo code:
I noticed the AS3 version is under MIT License. Is yours as well? |
Yeah |
for some reason, on webgl renderer method getcontext is always null. The only method returning an image is canvas.toDataURL("image/png"); this seems not to be compatible with this function, or maybe anyone has an idea how? |
Hi @deethee, Also to get the context you can always hijack createElement and getContext methods and save the context: new function() {
var orgCreateElement = document.createElement;
// hijack createElement to hijack all the canvases getContext
Object.defineProperty(document, 'createElement',
{value: function(type) {
var ans = orgCreateElement.apply(this, Array.prototype.slice.call(arguments));
if (type == 'canvas') {
var orgGetContext = ans.getContext;
// hijack getContext to catch all the contexts and save then in window.mainContext (or wherever . . .)
ans.getContext = function() {
if (!window.mainContext)
window.mainContext = [];
if (typeof arguments[1] === 'object')
// set preserveDrawingBuffer = true will help you with canvas.toDataURL("image/png"); method
arguments[1].preserveDrawingBuffer = true;
var c = orgGetContext.apply(this, Array.prototype.slice.call(arguments));
window.mainContext.push(c);
return c;
};
}
return ans;
}});
} That may be an overkill but just in case you're using some other framework (such as three.js) . . . Regarding @jonobr1 code unfortunately the browser always gets stuck in this line: encoder.addFrame(readBuffer, true); with very high CPU hz |
I've decided to go with that one: Works for me. |
No description provided.
The text was updated successfully, but these errors were encountered: