orxDisplay_FillPolygon not working properly?

edited March 2012 in Help request
My code creates a set containing 30 points which I then use to draw a polygon using orxDisplay_FillPolygon() function. Everything's fine when I do not fill it:

Sbhvg.png

But when I set the last argument to 'true' it looks like this:

0hlv1.png

Am I doing something wrong?

Comments

  • edited March 2012
    Mmh, interesting. The primitive draw functions are pretty new and haven't been extensively tested.

    Do you mind giving me your list of points so that I can try it on my side?
    Also, on which platform have you tried?
  • edited March 2012
    I'm on Windows XP, using VS2008 Express.

    List of points is generated on the fly. This headless cat consists of several body parts connected by revolute joints. I'm taking top left corner coordinates of each body part (orxObject_GetWorldPosition()) and calculating other corners as needed.

    Here's the render event handler (sorry for the messy code):
    http://pastie.org/3657106

    And config file with body parts:
    http://pastie.org/3657129
  • edited March 2012
    Using Sublime Text 2? ;)

    I'll look into that tonight. At first glance I don't see any issue with your code. I can think of a couple of things to make things easier on your side though, but that will be for when things are working fine. :)
  • edited March 2012
    Hi!

    The problem comes from the fact your polygons can't be drawn in filled mode due to their shape. I updated the doxygen doc to be more explicit for the orxDisplay_DrawPolygon() function.

    Only convex or star-shaped concave polygons whose first vertex is part of the polygon kernel can be directly drawn with that function. This is a common issue with 3D polygon rendering.

    For more complex polygons you'll need to decompose your polygons into smaller convex polygons for example (the easiest way often being to triangulate it).

    Or using sprites would make it probably much easier to handle.
  • edited March 2012
    Thank you very much. I split the entire character into smaller bits and now it's working perfectly :)
  • edited March 2012
    My pleasure!

    As for making your life easier, you can actually replace the rendering of the objects themselves with yours and use the orxFRAME hierachy to get the positions without having to do all the transformations yourself. I'll try to write an example during the week end if you want.
  • edited March 2012
    Sounds convenient. I'm a bit late as it's already past weekend, but if it wouldn't be a big bother I would greatly appreciate an example.
  • edited March 2012
    Sure!

    Sorry it slipped out of my mind during the week end so I'll try to do that in the coming days. :)
Sign In or Register to comment.