[Fluxus] 'polygon

Kassen signal.automatique at gmail.com
Thu Mar 4 04:57:45 PST 2010


Dave;

Clever!


I can't take any credit for being clever here; the only thing I did was poke
around and be persistent about it, that's how I learn.



> This may not work on all graphics cards, as it's making
> assumptions about how the hardware does the tesselation.
>

Ah, check. Well, I'm not burdened by any knowledge, the only thing I had to
go on was what comes up on the screen.


>
> In practice though it's possible that they all have converged on this
> approach as the fastest. It works here anyway :)
>

I'm on a fairly old Nvidia here. My Linux laptop is one that I got for free
as nobody else in my circle of friends wanted it. Hardly bleeding edge
material. If somebody on a Ati card could confirm that my "L" example runs
I'll take it to be safe in practice. If not I'll quit doing this for
portability reasons.

I wouldn't be surprised if you were right, but since video cards are all
about speed I think they would be better off just trying to ram the thing on
the screen instead of trying to check whether every 'polygon corner is
always convex at all corners. That would mean a fair amount of extra
instructions for many shapes every frame without any real gains.


> The official approach from the OpenGL docs is that you shouldn't use
> polygons to draw concave shapes, and the fluxus docs should be
> consistent with this I think.
>

Full agreement here.

I'm happy this is cleared up now. Last evening I was really wondering how it
could be that we were going "yes you can", "no you can't", "yes you can"
over this. You'll understand that I "knew" I was right but I also knew that
you -unlike me- actually know what you are talking about... so it was
slightly surreal to me.

I just ran another test. The tetris "s" shape was the most extreme case that
should work according to the theory I had about possible shapes that I could
come up with. Here is my test code;

(clear-colour (vector 0 0 0))
(clear)
(with-primitive
    (build-polygons 8 'polygon)
    (pdata-set! "p" 0 (vector  0  0 0))
    (pdata-set! "p" 1 (vector  0 -1 0))
    (pdata-set! "p" 2 (vector  1 -1 0))
    (pdata-set! "p" 3 (vector  1  1 0))
    (pdata-set! "p" 4 (vector  0  1 0))
    (pdata-set! "p" 5 (vector  0  2 0))
    (pdata-set! "p" 6 (vector -1  2 0))
    (pdata-set! "p" 7 (vector -1  0 0))
    (recalc-normals 1)
    (hint-wire)
    (wire-colour 0)
    (line-width 3)
    (colour (vector 1 0 0)))
)

On my card I can get away with this, but for me there is a slight glitch in
this already. The two main rectangles that make up this shape are lit in
slightly uneven ways. Going back to the "L", that one too has a (much more
slight) uneven lighting with a diagonal running across it that I missed
before. Apparently you can do this but clearly it's not "safe". Single
polygons should not have discontinuities in lighting, I feel.

Phew! Illegal OpenGL code! Illegal Tetris is possible, so are single-polygon
hearts.

Cheers,
Kas.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pawfal.org/pipermail/fluxus-pawfal.org/attachments/20100304/7278d389/attachment.html>


More information about the Fluxus mailing list