×

Discussion Board

Results 1 to 11 of 11
  1. #1
    Registered User
    Join Date
    Jul 2004
    Location
    Istanbul / Turkey
    Posts
    25

    Unhappy fillPolygon Method Does Not Work Correctly!

    As I said in the subject of the topic. The fillPolygon method in the Nokia UI Api does not work correctly. And drawPolygon method and fillPolygon method does draw different polygons.
    I want to inform all of you.

  2. #2
    Registered User
    Join Date
    Mar 2003
    Posts
    14
    Are you supplying the points in the correct order i.e. clockwise around the polygon? Apparently this is the only way it was designed to understand the data you give it.

    Hoped that helped!

    Sean Charles

  3. #3
    Registered User
    Join Date
    Jul 2004
    Location
    Istanbul / Turkey
    Posts
    25
    Yes I am supplying the points in a clockwise order.

    See it yourself:

    private int xCoor[] = { 10, 100, 100, 50, 50, 30, 30, 10 };
    private int yCoor[] = { 10, 10, 70, 70, 40, 40, 100, 100 };

    protected void paint ( javax.microedition.lcdui.Graphics g )
    {
    g.setColor ( 255, 255, 255 );
    g.fillRect ( 0, 0, getWidth(), getHeight() );
    DirectGraphics dg = DirectUtils.getDirectGraphics ( g );
    dg.fillPolygon ( xCoor, 0, yCoor, 0, xCoor.length, 0x88881122 );
    dg.drawPolygon ( xCoor, 0, yCoor, 0, xCoor.length, 0xFFFF0000 );
    }

  4. #4
    Registered User
    Join Date
    Mar 2003
    Posts
    14

    Nokia 3510i Seems OK

    URL corrected, there was a DOT after the j2me bit, sorry!

    http://bumpybibbers.com/j2me/polyshot.jpg

    I pasted your code, changed the co-ordinates to fit a 3510i and it seems to work OK, could you send me a screenshot to the forum of how your problem manifests itself?

    Sean Charles

  5. #5
    Registered User
    Join Date
    Jul 2004
    Location
    Istanbul / Turkey
    Posts
    25
    In the emulators( 7210 SDK, Epoc S60 ) and S60 Version 2 devices( 6600, 7610 ) , there was no problem. This bug is in the S40 real devices. I tried it in 6610, 7250i and 3220. All of them are same. But I haven't tried it in 3510i. So I can not get any screen shot from an emulator. Because they works successfully. But I drew it myself:

    http://www.geocities.com/softengilker/sample/bug.jpg

    You can see, drawPolygon and fillPolygon are working differently. left - down corner of the polygon is not filled.
    Last edited by softengilker; 2005-01-17 at 14:01.

  6. #6
    Registered User
    Join Date
    Mar 2003
    Posts
    14
    Blimey, I see the problem now!

    If the real device is playing up then I don't see what hope you have at all... even if there was a firmware update, all those users....

    It's a shame that Nokia didn't test properly before releasing the code....

    Sorry I couldn't help.

  7. #7
    Registered User
    Join Date
    Oct 2003
    Location
    Switzerland
    Posts
    15
    while testing our game on multiple Nokia S40 Devices we encountered the same problem. have a look at the courts (screenshots) of our game: minigolf-challenge (http://www.nowadays-interactive.com) - the base-layer is a always a (quite complex) polygon which prerendered and then "decorated" by adding more details.

    I tried a lot but couldn't get rid of that bug. Mostly the fillPolygon failed with vertices on the same y-line (like in your example).
    One "cheap" solution ist to change the vertice-coords of a vertice which is causing problems. But this is often not practicable and to be honest: this left me a quite bad feeling. =)

    At the end I implemented my own poly-/trifiller. this is easily done by:

    a) triangulate your polygon
    b) go through all triangles and fill them by using a scanline-filler

    this adds just a little more code to your app. (this may be a problem - I'm always fighting with space problems , but the result is very satisfying. Processing time is also good - wouldn't claim it's faster than the native function - but nearly equal...

    .. and the best is: no big deal to port your game to other devices. and that is quite an issue, if you want to go public on devices like SE-T6xx devices, which offer NO polyfill functionality at all.

    if you want, I will post a part of the the polyfill-code in here.

  8. #8
    Registered User
    Join Date
    Mar 2003
    Posts
    14
    It always feels good to beat the system. HA HA HA!! Well done... I can remember writing my first polygon flood fill in BASIC, on a RM380Z, in school, about 25 years ago and boy was it slooowwww! You could actually watch it filling dit by dot.

    It always amazes me how clever phones are, they are dismissed by most but compared to the computer that landed the first moon mission, they are incredibly powerful things.

    If there is one question that I would ask for some advice on it is this: how do you actually sell the games over the air without having to involve Nokia??? I had an argument with them a long time ago about the so called 'testing procedures' for a Nokia Software Marketplace 'badge' or something, they charged about $400 and in the small print there was no guarantee that the product wouldn't crash anyway so I asked them exactly what the fee was for... no reply.

    Any comments or pointers to information would be greatly appreciated as my first 3510i game is almost done (Blackjack, gotta start somewhere!) and I want to know how I can charge people for downloading it etc etc

    Sean Charles

  9. #9
    Registered User
    Join Date
    Jul 2004
    Location
    Istanbul / Turkey
    Posts
    25
    Yes please ysuter, I will be very glad if you post some part of your fill polygon method here. Because I don't understand your way very well. I think I would encounter some spaces, filling a polygon with triangles.

  10. #10
    Registered User
    Join Date
    Oct 2003
    Location
    Switzerland
    Posts
    15

    Trifiller Source Code

    Sorry for the little delay. I've uploaded a little package to our server with the trifiller source and a ready-to-run example of how to use it. the source is device-API-independent.

    you can download the source here:
    http://www.nowadays-interactive.com/...riFillTest.rar

    The example source is spezialized for triangles positioned inside the Canvas (no clipping needed). but it's quite easy to adapt it for a more general purpose. The only thing you need to do is to modify the border-offset precalc by adding y-pos clipping. the rendering-part doesn't need any adaptations at all, as the drawline method already handles every kind of clipping needed.

    Performance was good. we used the trifiller only to prerender courts - never for rendering per frame.

    note: the polygon-triangulation part is not included. I implemented it as part of the creating-process of the data-file in our export procedure. you will find a lot documents covering this topic on the internet.

    hope this will help you. Greetings,
    Yannick

  11. #11
    Registered User
    Join Date
    Jul 2004
    Location
    Istanbul / Turkey
    Posts
    25
    Thank you very much, ysuter. I hope it will help me.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×