danchitnis / webgl-plot

A high-Performance real-time 2D plotting library based on native WebGL
https://danchitnis.github.io/webgl-plot-examples/vanilla/
MIT License
576 stars 33 forks source link

Shapes rendering order #83

Open stefano-dallona opened 3 months ago

stefano-dallona commented 3 months ago

Hi Danial, first of all congratulations for your awesome library and also for sharing it with the community. I was wondering if it would be possible to add a feature to control the order in which different shape types are rendered. I saw from the code that for example now squares are rendered after lines and there's now way to overcome this behavior due to the _draw... methods being private, which is obviously good from code encapsulation perspective. Would it be possible to add a new config property containing a list of the shapes in the desired rendering order and have the draw method honour it ?

danchitnis commented 3 months ago

@stefano-dallona, thanks for bringing up this issue. Okay, I need to think of a way of calling the lower-level functions without affecting the higher-level ones. Which branch are you using?

stefano-dallona commented 2 months ago

Hi Danial, I'm using the library version coming from the npm package webgl-plot: 0.7.1 I found a way to mitigate the problem by using transparency with the color alpha channel. Nevertheless I think the mentioned feature could be really useful.