libgdx Shaperenderer线..如何绘制具有特定宽度的线 [英] libgdx Shaperenderer line .. How to draw line with a specific width

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

问题描述

我正在尝试使用libgdx形状渲染器绘制特定宽度的线.我遵循了这个链接

问题是如果我指定更多的线宽,即大于9,它不会显示增加的宽度.如果我指定20或100像素以上,则会有9个以上的结果

shapeRenderer.begin(ShapeType.Line);
    shapeRenderer.line(50, 70, 0, 50, 200, 0, Color.BLUE, Color.RED);
    int lineWidth = 20; // pixels
    Gdx.gl10.glLineWidth(lineWidth / camera.zoom);
     shapeRenderer.end();

谢谢 摇摇车

解决方案

查询支持的宽度范围和之间的大小差异 范围内支持的宽度,请使用参数调用glGet GL_ALIASED_LINE_WIDTH_RANGE,GL_SMOOTH_LINE_WIDTH_RANGE和 GL_SMOOTH_LINE_WIDTH_GRANULARITY.

参考

为避免特定于设备的行为,我改用四边形.从小纹理上绘制一个1x1的正方形,然后定位,缩放(取决于要绘制的线条的宽度和高度),着色并旋转它.

I am trying to draw a line of specific width using libgdx shape renderer. I followed this link

The problem is if i specify more line width i.e more than 9 it does not show increased width. More than 9 either i specify 20 or 100 pixels it will have the same result as 9

shapeRenderer.begin(ShapeType.Line);
    shapeRenderer.line(50, 70, 0, 50, 200, 0, Color.BLUE, Color.RED);
    int lineWidth = 20; // pixels
    Gdx.gl10.glLineWidth(lineWidth / camera.zoom);
     shapeRenderer.end();

Thanks Shakeel

解决方案

To query the range of supported widths and the size difference between supported widths within the range, call glGet with arguments GL_ALIASED_LINE_WIDTH_RANGE, GL_SMOOTH_LINE_WIDTH_RANGE, and GL_SMOOTH_LINE_WIDTH_GRANULARITY.

Reference

To avoid device specific behavior, I use a quad instead. Draw a 1x1 square from a small texture and then position, scale (depending on the width and height of the line you wanted to draw), color, and rotate it.

这篇关于libgdx Shaperenderer线..如何绘制具有特定宽度的线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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