OpenGL线宽 [英] OpenGL Line Width

查看:303
本文介绍了OpenGL线宽的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的OpenGL应用程序中,它不允许我绘制大于十个像素的线.有没有办法使它绘制超过十个像素?

In my OpenGL app, it won't let me draw a line greater then ten pixels wide. Is there a way to make it draw more than ten pixels?

void OGL_Renderer::drawLine(int x, int y, int x2, int y2, int r, int g, int b, int a, int line_width)
{   
    glColor4ub(r, g, b, a);

    glLineWidth((GLfloat)line_width);
    glBegin(GL_LINES);
    glVertex2i(x, y);
    glVertex2i(x2, y2);
    glEnd();
    glLineWidth(1.0f);
}

推荐答案

您可以尝试绘制四边形.将其设置为您想要的线长,然后使其高至所需的线宽,然后旋转并将其定位到该线将要到达的位置.

You could try drawing a quad. Make it as wide as you want your line to be long, and tall as the line width you need, then rotate and position it where the line would go.

这篇关于OpenGL线宽的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆