We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I have an issue when drawing a triangle strip with no stroke - the edges of the polygons are slightly visible.
By changing to P2D render it works fine in Processing, but I need it to work in Processing.js, where the problem persists.
Here's a link to a sketch to show the problem http://studio.sketchpad.cc/sp/pad/view/P0CunpgdMc/rev.7
I know this is a processing.js issue but the processing.js google forum seems inactive.
Thanks for any help on this..
Answers
As an ancient JS library, Pjs got 2 renderers only for its size()'s 3rd parameter:
https://Developer.Mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext
Setting to P2D fixes it inside Processing, but not in Pjs. I know it's ancient, maybe that's the problem. Hoping it will work in P5js.
sorry for sounding dumb, I've no experience in js at all :( Is there a way to set the canvas rendering context from within Processing?
JAVA2D, FX2D, P2D, P3D or OPENGL, as its 3rd argument. :-B
Thanks again for a full response! However, like I mentioned in the original post and in the code example link, when I pass P2D - it makes no difference. P2D fixes the problem inside processing, but when I run the js version telling it to render with P2D, it seems to be reverting to the default renderer rather than P2D.
Re-read my very 1st reply. Pay attention to which rendering context constant P2D belongs to! :-t
Pick the constant which corresponds to the browser's rendering context you wish to activate. ;)
yes it's the CanvasRenderingContext2D I need (P2D) - but I don't know where to go from there.
However, like I've stated before: >-)
Constant P2D is an OpenGL-based renderer since Processing 2.x.x! #-o
Run this little code under Processing (not Pjs) in order to know whether current renderer is OpenGL-based: :ar!
'true'
So, if Processing's renderer P2D is OpenGL-based since P2, which browser's rendering context should you pick for Pjs: '2d' or 'webgl'? :>
Can you just tell me how to get it working, or if it will work at all, many thanks.
That looks like anti-aliasing. It's drawing the edges blended with the background in order to make them look smoother. Try noSmooth() or smooth(0) or whatever.
Well it seems to be working better with OPENGL :) http://studio.sketchpad.cc/sp/pad/view/P0CunpgdMc/rev.46
Sorry for wasting your time - but we got there in the end..
yeah I need the anti aliasing though - which brings me to my next problem - anti aliasing isn't working under OPENGL with the smooth() function. Also the depth sorting is screwed up from what it should look like (based on the project I'm currently working on).
A Cross-Mode Java-Pjs sketch: O:-)
thanks for that.. But I think I'm gonna transfer to P5 - having to many problems with processing.js