Drawing outline of 2D shapes in OpenGL while changing the line thickness -
so i'm trying (what think simply) draw outline of number of 2d shapes using opengl. seems work until try change line thickness of outline using gllinewidth(w);
first issue w = 10 or w = 3000 (or larger number) shows same line thickness, smaller w=3 produces thinner line.
i figure has it. max seems 7 can increase or something? want draw thick line!!
float linewidth[2]; glgetfloatv(gl_line_width_range, linewidth); std::cout<<"min: "<< linewidth[0]<<" max: "<<linewidth[1]<<"------\n";
my second issues points @ lines meet don't seem line or something, makes litte bits missing in shapes (rectangle, circle, triangle). behaviour has been mention here draw percentage of circle outline couldn't seem fix post says.
this code i'm using draw rectangle:
gllinewidth(20); glbegin(gl_line_loop); glvertex2f(x1, y1);//1 glvertex2f(a1, a2);//2 glvertex2f(x2, y2);//3 glvertex2f(b1, b2);//4 glend();
from post mentioned above code i'm using circle:
glenable(gl_line_smooth); gllinewidth(10); glbegin(gl_line_strip); (int i=0; < (360/10*100/10); i++) { float deginrad = i*deg2rad; glvertex2f(x1+cos(deginrad)*r,y1+sin(deginrad)*r); } glend();
the "bits missing" looks this:
i've had @ post how render perfect wireframed rectangle in 2d mode opengl? following leads there didn't help.
my first issue w = 10 or w = 3000 (or larger number) shows same line thickness, smaller w=3 produces thinner line.
check opengl implementation supports via glget()
, gl_line_width_range
. wouldn't surprised if topped out @ 10.0
.
i want draw think line!!
for large line-widths you'll have do yourself using triangles/quads.
the "bits missing" looks this:
opengl doesn't specify how gl_lines
widths > 1.0
supposed joined/endcapped. it's implementation.
Comments
Post a Comment