ofLine&ofRect with unapprehensive shape

ofRect(100, 100, 100, 100);
ofLine(10, 10, 100, 100);

I don’t understand why both line and rect rendered with 2px border.

But after the line rotate n degrees, the result’s border turn into 1px.

ofLine(10, 10, 100, 100);

Or maybe there is another way to render rect / line.

You can specify the stroke width, but i think that what you are seeing its a visual effect coming from the antialiasing.

can control the aliasing with ofDisableAntiAliasing()/enable or telling the num of samples in main.cpp (i don’t know if its the right word for that)

if you can tell the stroke width you can do this


ofStyle st;
st.lineWidth = 1;
st.bFill = false;

ofRect(50, 50, 500,300);


Thx a lot! I call ofDisableAntiAliasing(), finally the line turn into 1px!