简体   繁体   中英

LibGdx:Alternatives to ShapeRenderer

Note: I am new to LibGdx with android.

I am Creating a clone of the famous game Color Switch for practice purposes.

I have used ShapeRenderer for creating the ball and moving circles. After reading more about ShapeRenderer, I realized it is mostly used for debugging purposes, so I searched for other alternatives to it and I got to know about Pixmaps but I am stuck on how to use it and cannot find any source.

So I want to know if there any other alternatives to ShapeRenderer or any sources for Pixmaps to get started?

ShapeRenderer is perfectly fine for your use-case. So, unless you have an actual problem with it, there is no need to switch to something else.

The reason that ShapeRenderer is primarily used for debugging is because it's limited to basic shapes and colors. In many use-cases this is insufficient and eg images (like .png files) are used instead. In those cases SpriteBatch is typically used to draw the images, which is optimized for (rectangular) images instead of shapes.

A Pixmap is the raw image data in CPU memory (RAM), which is practically an interim step between the image on disk (eg the .png file) and the image ( Texture ) in GPU memory (VRAM). LibGDX handles this interim step for you, so you should never have to deal with Pixmap in most use-cases yourself. Manually manipulating a Pixmap is very costly operation and worse than using ShapeRenderer for your use-case.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM