microsoftarchive / openFrameworks

OpenFrameworks is a cross platform open source toolkit for creative coding in C++.
http://openframeworks.cc
Other
39 stars 24 forks source link

ofSetLineWidth() not working #43

Closed ghost closed 10 years ago

ghost commented 10 years ago

Started writing tutorials for OF for Windows Store, found this one.

ofSetLineWidth() doesn't change the line width drawn with an ofLine() call. It stays at the default 1 pixel width, regardless of value.

So this: ofSetColor(ofColor(255, 0, 255)); ofSetLineWidth(5.0); // <- DOESN'T CHANGE LINE WIDTH ofLine(ofPoint(0,100) ofPoint(100,100));

will still render at 1 pixel, doing the same thing as the default: ofSetColor(ofColor(255, 0, 255)); ofLine(ofPoint(0,100) ofPoint(100,100));

figment3d commented 10 years ago

This seems like it might be related to the point sprite solution discussed recently:

https://bay169.mail.live.com/default.aspx#tid=cmV8p0q87E4xGHf9idZ18lDA2&fv=1&fid=flsearch&srch=1&skws=point%20sprite&sdr=4&satt=0

steven-chith commented 10 years ago

This is a tricky one. ANGLE sets an internal variable to deal with storing line width, but doesn't do anything with it while rendering lines. I'm almost inclined to say it's a Google issue. The other way of going about this is drawing a quad of the desired thickness. We could modify ANGLE to use geometry shaders for line thickness like it does for point sprites.

figment3d commented 10 years ago

Drawing thick lines as quads is limited because it doesn't handle corners properly.

It takes some extra work to handle sharp corners for road widening, etc. It might be worth addressing with the initial approach.

corners

stammen commented 10 years ago

According to the spec only a glLineWIdth of 1 is guaranteed to be supported. Any other widths are specific to the opengl es implementation. Angle only supports a width of 1.

http://www.khronos.org/opengles/sdk/docs/man/xhtml/glLineWidth.xml