🌶️ Create points with a different shape

Tired of square Point entities? Here there are a few tricks to build points with the shape you want.


First solution: using ImageOnly Label

An easy solution could be using an ImageOnly label with a semi-transparent image:

Bitmap bmp1 = new Bitmap(@"pointImage.png");
int halfW = bmp1.Size.Width / 2;
int halfH = bmp1.Size.Height / 2;
ImageOnly img = new ImageOnly(10, 20, 0, bmp1, halfW, halfW);
ImageOnly img2 = new ImageOnly(50, 80, 0, bmp1, halfW, halfH);


Second solution: creating a Picture ZoomInvariant

A little bit more complicated solution is to follow the instructions in the Zoom Invariant / Position Invariant Entity article and extend the class Picture initialized with an image that has the same characteristics described in the previous solution.


Alternative solution (OpenGL only)

There is an alternative solution to the previous ones that is possible to use only with OpenGL renderer.

A shader allows you to use Point sprites, meaning points that are drawn with a texture always facing toward the viewer. This allows drawing points with various shapes, simply providing the point coordinates and a texture. Please check the Shaders code sample.



If you look for circular-shaped points, in most cases enabling antialiasing can do the trick.


Was this article helpful?
1 out of 1 found this helpful


1 comment
Date Votes
  • Amazing post!


Please sign in to leave a comment.

Articles in this section

See more