# More draw functions for convex shapes (DEF-2067)

**URL:** <https://forum.defold.com/t/more-draw-functions-for-convex-shapes-def-2067/2682>\
**Category:** Feature requests (USE GITHUB)\
**Created:** [August 21, 2016, 8:56am UTC](https://forum.defold.com/t/more-draw-functions-for-convex-shapes-def-2067/2682 "2016-08-21T08:56:56Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pkeod](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/pkeod/32/606_2.png) [@Pkeod](https://forum.defold.com/u/Pkeod)\
**Post date:** [August 21, 2016, 8:56am UTC](https://forum.defold.com/t/more-draw-functions-for-convex-shapes-def-2067/2682/1 "2016-08-21T08:56:56Z")

</div>

Maybe a draw polygon, and then you specify the number of sides and the radius? Then you also specify to fill or only be outlines. This would help with testing and prototyping. It’s a feature which other engines have better support of, and porting projects to Defold would be helped by adding it.

```lua
msg.post("@render:", "draw_polygon", { position = vmath.vector3(200, 200, 0), sides = 3, radius = 42, style = 0, rotation = 0, scale = 1 } ) 
-- draw a triangle with , 0 for outline only no fill

msg.post("@render:", "draw_convex_shape", { position = vmath.vector3(200, 200, 0), points = { ... }, style = 0, rotation = 0, scale = 1 } ) 
-- draw a convex hull, position would be based on the center of mass

```

---

<div class="post-metadata">

**Author:** ![britzl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/britzl/32/23_2.png) [@britzl](https://forum.defold.com/u/britzl)\
**Post date:** [August 22, 2016, 6:03am UTC](https://forum.defold.com/t/more-draw-functions-for-convex-shapes-def-2067/2682/2 "2016-08-22T06:03:55Z")

</div>

Hmm, I wonder what would be the best way of achieving something like this? I’m not sure that adding more functions to complement the draw\_line and draw\_text messages is a good way to go about it. @sven and @Ragnar_Svensson, is this something that has been discussed?

---

<div class="post-metadata">

**Author:** ![Pkeod](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/pkeod/32/606_2.png) [@Pkeod](https://forum.defold.com/u/Pkeod)\
**Post date:** [August 22, 2016, 6:47am UTC](https://forum.defold.com/t/more-draw-functions-for-convex-shapes-def-2067/2682/3 "2016-08-22T06:47:04Z")

</div>

How are the shapes drawn for 2d physics debug?

---

<div class="post-metadata">

**Author:** ![britzl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/britzl/32/23_2.png) [@britzl](https://forum.defold.com/u/britzl)\
**Post date:** [August 22, 2016, 8:35pm UTC](https://forum.defold.com/t/more-draw-functions-for-convex-shapes-def-2067/2682/4 "2016-08-22T20:35:36Z")

</div>

Not sure. @sven?

---

<div class="post-metadata">

**Author:** ![Ragnar\_Svensson](https://forum-defold.b-cdn.net/letter_avatar_proxy/v4/letter/r/b5ac83/32.png) [@Ragnar\_Svensson](https://forum.defold.com/u/Ragnar_Svensson)\
**Post date:** [August 23, 2016, 3:24am UTC](https://forum.defold.com/t/more-draw-functions-for-convex-shapes-def-2067/2682/5 "2016-08-23T03:24:29Z")

</div>

The physics debug graphics are drawn by c++ code, i.e. pretty much hardcoded. I think it would make sense to have something very simplistic supported by default (draw\_box, draw\_sphere) and then a future extension for more complex things like arbitrary polygons.

---

<div class="post-metadata">

**Author:** ![sven](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/sven/32/1086_2.png) [@sven](https://forum.defold.com/u/sven)\
**Post date:** [August 23, 2016, 7:14am UTC](https://forum.defold.com/t/more-draw-functions-for-convex-shapes-def-2067/2682/6 "2016-08-23T07:14:00Z")

</div>

Added an issue for this feature request; DEF-2067

---

<div class="post-metadata">

**Author:** ![iyevseyev](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/iyevseyev/32/15623_2.png) [@iyevseyev](https://forum.defold.com/u/iyevseyev)\
**Post date:** [May 3, 2019, 8:04pm UTC](https://forum.defold.com/t/more-draw-functions-for-convex-shapes-def-2067/2682/7 "2019-05-03T20:04:33Z")

</div>

Hey! Any updates?

---

<div class="post-metadata">

**Author:** ![Mathias\_Westerdahl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/mathias_westerdahl/32/228_2.png) [@Mathias\_Westerdahl](https://forum.defold.com/u/Mathias_Westerdahl)\
**Post date:** [May 4, 2019, 9:18am UTC](https://forum.defold.com/t/more-draw-functions-for-convex-shapes-def-2067/2682/8 "2019-05-04T09:18:00Z")

</div>

I’m afraid not.  
Note that these functions are really just for debug features too.  
As we do more work on our 3D support though, we’ll need to add support for new vertex formats, and I think at that point we’ll be able to provide a better methods to achieve this.
