开发者

Make openGL lines connected

Right now I'v created a polygon, then I do the same thing but with line_loop to draw the outline. My issue right now is if I set the line thickness to high, the lines arn't connected. Their ends would need to be (linewidth) longer... is there a way to fix this?

Thanks

glMatrixMode (GL_PROJECTION);
        glLoadIdentity ();
        glOrtho (0, 600, 600, 0, 0, 1);
        glMatrixMode (GL_MODELVIEW);
......
glLineWidth(5.0);
glTranslatef(250,250,0);
glRotated(x,0,0,50.0);
开发者_C百科    glBegin(GL_POLYGON); //Begin quadrilateral coordinates
    //Trapezoid
    glColor3f(255,0,0);
glVertex2f(0,0);
glVertex2f(100,0);
glVertex2f(100,100);
glVertex2f(50,50);
glVertex2f(0,100);

    glEnd(); //End quadrilateral coordinates

    glBegin(GL_LINE_LOOP); //Begin quadrilateral coordinates

    //Trapezoid
    glColor3f(0,255,0);
    glVertex2f(0,0);
    glVertex2f(100,0);
    glVertex2f(100,100);
    glVertex2f(50,50);
    glVertex2f(0,100);

    glEnd(); //End quadrilateral coordinates


The article here shows how to achieve rounded line caps and antialised lines using a texture trick.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜