We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hello I try to test the renderer, but it's not accessible. there is an other way to know the rendering mode ?
void setup() {
size(400,400, P3D) ;
if (renderer.equals(P3D)) println("P3D") ; else println("2D" ) ;
}
Answers
You already know what the renderer is because you use it in size, but this will work if you want to find out in other methods
https://forum.Processing.org/two/discussion/8045/how-to-format-code-and-text
A better alternative based on forName() & isInstance() from Class: :-bd
A bad advise but a very curious Java case... =;
In @quark's example, since field renderer is a known compile literal, we don't need equals() for comparison against another String constant.
Exceptionally we may choose risking on going straight w/
==
equality operator for such cases: :ar!Nonetheless, it's still too risky to use
==
to compare String constants.However,
switch () {...} / case: ...
is a gr8 replacement since it relies on equals() internally: :bzAn updated & more flexible version to deal w/ createGraphics() instances too: :D
Whaouuuuu totaly answering :) Thx a lot Processing brothers !
Glad you've liked it, @Stanlepunk. B-)
However I've forgotten about SVG renderer. And b/c both PDF & SVG are subclasses of JAVA2D, PDF renderer was returning as if it was JAVA2D! b-(
But for sake of correctness, here's a more correct behavior fix. Plus some speed tweak checks: :D
thanks for the improvement !!!! very nice code