libgdx- pixmap: can I somehow change the width of the line?(libgdx- pixmap:我能以某种方式改变线条的宽度吗?)
问题描述
我想画一条线,然后生成一个纹理(使用 libgdx).我发现使用 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:我能以某种方式改变线条的宽度吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:libgdx- pixmap:我能以某种方式改变线条的宽度吗?


基础教程推荐
- Struts2 URL 无法访问 2022-01-01
- 如何对 Java Hashmap 中的值求和 2022-01-01
- REST Web 服务返回 415 - 不支持的媒体类型 2022-01-01
- 问题http://apache.org/xml/features/xinclude测试日志4j 2 2022-01-01
- 使用堆栈算法进行括号/括号匹配 2022-01-01
- 修改 void 函数的输入参数,然后读取 2022-01-01
- 存储 20 位数字的数据类型 2022-01-01
- Spring AOP错误无法懒惰地为此建议构建thisJoinPoin 2022-09-13
- RabbitMQ:消息保持“未确认"; 2022-01-01
- 无法复制:“比较方法违反了它的一般约定!" 2022-01-01