libgdx- pixmap:我可以以某种方式改变线的宽度吗? [英] libgdx- pixmap: can I somehow change the width of the line?

查看:197
本文介绍了libgdx- pixmap:我可以以某种方式改变线的宽度吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想绘制一条线然后生成纹理(使用libgdx)。我发现用pixmap创建圆形,矩形和线条的纹理很简单。
但我没有找到如何设置绘制形状的线宽。
有没有可能设置pixmap的线宽?

I want to draw a line and then generate a texture (with libgdx). I found out that creating a texture from circles, rectangles and lines is simple with pixmap. But I didn't find out how to set the linewidth of the drawn shape. Is there any possibility to set the linewidth for pixmap?

这是我到目前为止的代码:
(我试图绘制两个填充的圈子并用线连接它们)

Here is the code I got so far: (I tried to draw two filled circles and to connect them with a line)

Pixmap pixmap = new Pixmap( 16, 16, Format.RGBA8888 );
pixmap.setColor(Color.BLUE);
pixmap.fillCircle(x1, y1, 10);
pixmap.fillCircle(x2, y2, 10);
pixmap.drawLine(x2, y2, x1, y1); // this line is very thin
Texture pixmaptex = new Texture( pixmap );
pixmap.dispose();


推荐答案

OpenGL实现不能可靠地支持线宽。要绘制胖线,请绘制一个矩形。

Linewidth isn't reliably supported by OpenGL implementations. To draw "fat" lines, draw a rectangle.

参见 Libgdx gl10.glLineWidth()

这篇关于libgdx- pixmap:我可以以某种方式改变线的宽度吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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