We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hi guys! Has anyone successfully exported a high resolution transparent png image from a sketch using a P3D render mode? This is possible before using P5 v1.5.1, but it seems there are some errors working it in P5 v2.
Any help will be greatly appreciated. Thanks!
Answers
Anyone?
Has anyone managed to do this already?
Note that P3D mode in 1.5.1 was a Java 2D mode with "simulated" 3D, so transparency and off-line graphics buffers worked the same.
In v.2, P3D (and even P2D) are OpenGL mode, so the way to handle transparency and off-line images changes a lot. I am not an OpenGL export, so I leave somebody else to give hints.
Perhaps you can show a very simple sketch illustrating your issue, so somebody can show how to do it properly?
Hi PhiLho! Actually, it's just the same code as the last time here: http://forum.processing.org/two/discussion/3155/opengl-error-1282-at-top-enddraw-invalid-operation . I thought that since nobody answered my last post about the OpenGL error, I might as well asked if someone managed to export a high resolution png image in P3D using P5 v2.1.1, which was the original reason actually why I managed to arrived at that problem.
But here's my initial code in exporting a high res png image using P3D:
boolean record = false; int scalePG = 3;
Up!
Up!
Up! For the last time.
Also, can anyone please test the code below in your current setup, and please tell me if it work or not? Thank you very much!
64-bit Lubuntu 13.04, Linux 3.8.0-35, Processing 2.0.2, 64-bit OpenJDK 7.51, Intel Q6600, GeForce 9800GT, VDPAU 331.20 driver.
After declaring some variables, your code above run & saved successfully!
I've also tweaked a simplified version:
Please don't bump your thread multiple times a day.
I corrected your code and commented the changes:
Oh, and please include variable definitions (the first two lines), otherwise your code isn't even compileable.
@Poersch First of all, my apologies for bumping my thread up several times back. It seems at first nobody knows how to fix the issue.
Before in 1.5.1, I used to think that PGraphics.save should be, and will always be place after endRecord(). I mean just like any other general recording methodology, stop or an end is needed before we can save anything. :) But thank you very much for the solution. It was definitely the answer I was looking for. And yeah, I forgot to copy and paste some of the variables in my code above. Sleepy I guess. :)
@GoToLoop Thank you also for testing out the code. Appreciate it.
Funny in my version w/ P 2.0.2, I was able to place save("") after endRecord() w/ no problems at all! @-)
@GoToLoop Sorry. What I'm trying to imply is that before, I thought that save() comes after endRecord(). I was just basing it on the same basic process of recording, in general. Like recording an audio or video using a camera or recorder, that before you could save it, you have to stop or end the recording first. :)
@GoToLoop, @sephm: They seem to have changed the endRecord() code - maybe to reduce the chance of memory leaks?
@Poersch Maybe it has something to do with P3D being handled with OpenGL? Just an idea.
P2D & P3D are OpenGL in Processing 2+ versions. While in Processing 1+, they weren't!
@sephm: P2D and P3D are based on OpenGL since Processing 2.0, but as GoToLoop stated, saving the record-canvas after calling endRecord() works in 2.0.2, so OpenGL alone can't be the reason.
Hello!
I have implemented the same method in my code. The resolution works fine, but my drawing appears in the bottom left corner and it is really small. Any clue about that?
cheers, R
Same issue as @Raffish here. Only now saw this thread - posted about the problem in the following link (including pictures): https://forum.processing.org/two/discussion/17162/high-resolution-output-for-p3d