对特定的行使用glLineWidth而不影响其他行 [英] Use glLineWidth for a particular line without affecting other lines

查看:174
本文介绍了对特定的行使用glLineWidth而不影响其他行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是OpenGL的新手.我只是想使用glLineWidth来加粗一行,但这也会影响所有其他行.因此,我尝试了另一种方法,将glLineWidth放在开始和结束之间,然后就没有用了.我的代码如下所示:

I'm new to OpenGL. I simply want to thicken one line using glLineWidth, but that also affects all other lines as well. So I tried the other way by putting glLineWidth inside between begin and end, then it didn't work. My code is shown below:

glBegin(GL_LINES);
glLineWidth(3);
glVertex2f(5, 10);
glVertex2f(30, 35);
glEnd();

glBegin(GL_LINES);
glVertex2f(20, 25);
glVertex2f(50, 55);
glEnd();

那么有什么方法可以使这条线变粗吗?我一直在谷歌搜索,但找不到简单的解决方案:S

So is there any way to make only this line thicken? I've been googling but can't find a simple solution :S

推荐答案

您尝试过这种方法吗?

glLineWidth(3);
glBegin(GL_LINES);
glVertex2f(5, 10);
glVertex2f(30, 35);
glEnd();

glLineWidth(1);
glBegin(GL_LINES);
glVertex2f(20, 25);
glVertex2f(50, 55);
glEnd();

这篇关于对特定的行使用glLineWidth而不影响其他行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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