-
Notifications
You must be signed in to change notification settings - Fork 37
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
Something wrong with pop() [WEBGL constant is another issue] #3
Comments
Using _P5_INSTANCE.WEBGL I get this: |
I got the same error here, but at least the 3D is working for now WEBGL. |
Updates to ongoing investigation: The issue here is related to how Transcrypt converts the Reading Transcrypt's source code, I was able to find the line where this mapping is defined. But I think it's a compile error, since our |
Transcrypt's
|
Based on https://www.transcrypt.org/docs/html/special_facilities.html#id2, I think there are more instructions with this issue.. |
@eduardostalinho I think this is true only for methods from P5.js that matches with any of those aliases definition. I spent today's morning taking a look at them and it seemed that case only occurs with Anyway, if we have the same error in the future with other functions, we'll already know how to fix them. So, I'm closing this issue as solved! Thanks for your PR =] |
Hi all, I think this issue might have to open up again, or at least as a separate issue. p5.Renderer objects also contain from pyp5js import *
def setup():
createCanvas(700, 700)
gr = createGraphics(500, 500)
gr.push()
gr.pop() will get compiled into this equivalent Javascript export var setup = function () {
if (arguments.length) {
var __ilastarg0__ = arguments.length - 1;
if (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty ("__kwargtrans__")) {
var __allkwargs0__ = arguments [__ilastarg0__--];
for (var __attrib0__ in __allkwargs0__) {
}
}
}
else {
}
createCanvas (700, 700);
var gr = createGraphics (500, 500);
gr.push ();
gr.py_pop ();
}; Which will result in the following error gr = createGraphics(500, 500)
gr.clear() gets transcrypted into var gr = createGraphics (500, 500);
gr.push ();
gr.py_clear (); Creates the error I have tried this in the def createGraphics(*args):
__pragma__('noalias', 'pop')
graphics = _P5_INSTANCE.createGraphics(*args)
__pragma__('alias', 'pop', 'py_pop')
return graphics but didn't fix anything. Do any of you have thoughts on how this might be avoided? |
Oh you know what, nevermind. I now understand I can do this instead in my python script and it will work as expected: from pyp5js import *
def setup():
createCanvas(700, 700)
gr = createGraphics(500, 500)
gr.push()
__pragma__('noalias', 'pop')
gr.pop()
__pragma__('alias', 'pop', 'py_pop') The pragma just needs to be in my code instead of in the pyp5js library. I can open up a pull request with additional documentation on this quirk. |
Thanks for figuring this out @kylepollina! Unfortunately pyodide support (#124) is not ready yet. Once we have this done, these transcrypt specific fixes won't be necessary anymore =] |
I'm sure we'll have 3D at some point :)
So let's put a small test example here:
I guess this is a bit early... but, who knows?
The text was updated successfully, but these errors were encountered: