We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › opengl lines with strokeWeight > 1
Page Index Toggle Pages: 1
opengl lines with strokeWeight > 1 (Read 1241 times)
opengl lines with strokeWeight > 1
Nov 6th, 2005, 6:06pm
 
I'm having a problem rendering opengl lines.

With strokeWeight set to 10, using beginShape(LINE_STRIP) and then drawing a line by repeatedly calling curveVertex() with some coordinates and then calling endShape() the resulting line looks like it's not joining up correctly at the vertices. see image http://www.atomless.com/images/line_opengl.gif

anyone know of a way to make it join up correctly? - I know that strokeCap and strokeJoin are not supported under openGL but it kinda seems like this may be where the fault lies??
Re: opengl lines with strokeWeight > 1
Reply #1 - Nov 6th, 2005, 10:27pm
 
As far as I understand, opengl doesn't have a standard definition for how to deal with lines thicker than 1 pixel, so each video card can essentially do whatever it wants.  I saw an article/screenshot set of this at some point, but don't remember where off hadn.

Your best bet is to either use the Java 2d engine (default renderer), or recreate lines from scratch using polygons and handling the caps/joins with your own code.  I suppose theoretically the OpenGL renderer for Processing could be modified to handle this internally, but I'm not sure if anyone is too keen on doing this.  I suppose if you got a working standalone implementation it could be integrated at a later point.

Marcello
Re: opengl lines with strokeWeight > 1
Reply #2 - Nov 7th, 2005, 10:35am
 
thanks marcello.

I think I'll take your advice and write my own polygon or quad variable thickness line code.

Although it does seem to me that if strokeWeight works with the openGL renderer then processing should handle the line thickness properly??
Re: opengl lines with strokeWeight > 1
Reply #3 - Nov 7th, 2005, 3:14pm
 
marcello is correct, and opengl doesn't support this. in fact, no 3D renderer i've ever seen does so. this is noted on the bugs page in the faq, and more details of the issue are here:
http://dev.processing.org/bugs/show_bug.cgi?id=123

it mostly boils down to time and how does one support caps/joins in 3D? how would you put a thick stroke on a 3D box? basically you'd need a box at each edge, so that it would be properly stroked no matter how the rotation worked. it can be made to work for some cases, but will require some trickery.
Re: opengl lines with strokeWeight > 1
Reply #4 - Nov 7th, 2005, 7:23pm
 
thanks ben,

for now I managed to adapt the line code you posted in answer to a previous question a good while ago and it works nicely.
http://processing.org/discourse/yabb_beta/YaBB.cgi?board=Programs;action=display;num=1115832547;start=2#1
Just changed the order of the vertices to work with TRIANGLE_STRIP.

Re: opengl lines with strokeWeight > 1
Reply #5 - Feb 22nd, 2007, 3:46am
 
Hi,

any news about strokeWeight and OpenGL since the previous post ?

I'm trying to use strokeWeight() with OpenGL.
I have found the code example of the bug123 but I have still not been able to make it work with bezier()

strokeWeight(d);
bezier(x1, y1, x1, y1, x3, y3, x2, y2);

any advice is welcome.

Best,
Page Index Toggle Pages: 1