libgdx- pixmap: can I somehow change the width of the line?

风流意气都作罢 提交于 2019-12-10 09:09:34

问题


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();

回答1:


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

See Libgdx gl10.glLineWidth()



来源:https://stackoverflow.com/questions/20441424/libgdx-pixmap-can-i-somehow-change-the-width-of-the-line

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!