Polyvector advantages....

Previous topic - Next topic

gregbug

Excuse the beginner question ....  ::)
What are the advantages of using PolyVector instead of DrawSprite?
There are advantages in terms of speed? (and if there are ... as you can 'optimize everything to get the maximum speed of drawing?)

Thanks to all who have the time and patience to answer me ...  :P
Ciao Ciao,
Gianluca. (l'Aquila tornerà a volare alta nel cielo!!!!)

Moru

With polyvector you can specify the color of all corners which means flashing sprites in different colors, you can stretch in different angles, rotate and do whatever you like to the poor little things, Drawsprite just ... draws a sprite :-)

gregbug

Quote from: Moru on 2010-Jan-29
With polyvector you can specify the color of all corners which means flashing sprites in different colors, you can stretch in different angles, rotate and do whatever you like to the poor little things, Drawsprite just ... draws a sprite :-)

ah ok. thanks Moru!
but how about the speed? polyvector is faster?
Ciao Ciao,
Gianluca. (l'Aquila tornerà a volare alta nel cielo!!!!)

Moru

No, polyvector should be slower in most cases but I don't think the difference is big. Should hardly be noticable even with thousands of sprites/polys

Kitty Hello

On the iPhone, a huge polyvector batch can be rendered faster than lots of drawsprite calls.

Serge

Hi,

I am trying to use POLYVECTOR in order to draw a Polygon, but I noted that it is not filled as I expected. I need that the polygon is filled only by inside, but instead, the polygon is filled drawing a triangle from the first edge to the rest of them, so concave polygons are not filled correctly (i.e. when drawing a star, please see my attached image).

I found that there are some algorythms to do it (i.e. scanline algorythm) , but before implement it I would like to know it this is already implemented for GLBasic.

Thanks and regards

Serge
www.tiptapgames.com

[attachment deleted by admin]

Ian Price

Can you not just use a star image texture on a square polyvector? That will produce the same result surely?
I came. I saw. I played.

Serge

Well, i used the star just an a example of what I am trying to do, in fact I need to be able to draw any irregular polygon and fill it. So,since the polygons will be randomly created I can not use the approach of using images. :(

thanks and regards

Kitty Hello

do a triangle fan, and start with the center point

gregbug

#9
again on polyvector...  =D

I'm trying to optimize my code... to render sprites using polyvector... for iPhone 3GS

using simple polyvector the speed is the same that using Drawsprite... (tested on 250 sprites 32x32 pixel)  :zzz:
using polyvector if i modify the color param the speed or alphamode on my iPhone is very very very slow... (30fps -> 1-2 Fps!!!)  :'(

I tried to use POLYNEWSTRIP and i had an huge speed boost! (solid 60fps) even if i change the color param or alphamode of polyvector...  :good:

now... my questions are:

1. is possible to change the alphamode of a sigle sprite using POLYNEWSTRIP ? ... if i change a sigle alpha value on a sprite all sprite change the alpha value... !

2. why on normal polyvector the color param or alphamode is so slow? (on iPhone) and on POLYNEWSTRIP do not slow ?

thanks!

Gianluca.

Ciao Ciao,
Gianluca. (l'Aquila tornerà a volare alta nel cielo!!!!)

yaKC

#10
I'm having trouble understanding how to use PolyVector, I can't seem to see
what coordinates are being given and how to draw a simple oblong sprite :(


from the help file

STARTPOLY 1001 // Bitmap = No.0
  POLYVECTOR   0,   0,  0,  0, RGB(255, 255, 255)
  POLYVECTOR   0, 300,  0, 64, RGB (255, 255, 255)
  POLYVECTOR 300, 300, 64, 64, RGB(255, 255, 255)
  POLYVECTOR 250,  50, 64,  0, RGB(  255, 255,   255)
ENDPOLY

All I would like to be able to do is draw a sprite that is say
160 pixels by 110, but don't know what the above is doing, do
I have to draw a box/square/oblong using triangles as I
thin? It says you have to enter coordinates anti clocwise too..

Would be VERY VERY grateful if someone could help me please :)

sorry, figured it now now :D With not nowing anything about this command and 3D etc I had
the idea that You had to use triangles, which I didn't need, can't belive I was confused hehe :D



Kitty Hello

Quote from: gregbug on 2010-Apr-18
1. is possible to change the alphamode
2. why on normal polyvector the color param or alphamode is so slow?
1. Not, yet. I try to allow that with an ALPHAMODE in between the POLYVECTOR calls.
2. colour pointers are very expensive on OpenGL|ES devices. Use a texture instead wherever applicable.

Scott_AW

I noticed using only colors instead of a texture in 3d and 2d polygons can slow things down on certain systems, which is wierd in a way.  Think it would be possible to have an alternate polyvector and x_objaddvertex with an alpha flag?  I know from working with Direct X in Game Maker I was able to setup polygons with alpha values to create some nice effects like gradual opacity from transparent.
Current Project, Orbital Contract Defense
http://gamejolt.com/games/adventure/code-name-ocd/9887/

BlackShadow now open source/resource(requires duke3d)
http://gamejolt.com/games/adventure/black-shadow-3d/9885/

gregbug

#13
please... please... add polyvector with alpha!!!!  =D
i need it in my sprite lib (iPhone) that use polyvector and POLYNEWSTRIP

thanks!.
Ciao Ciao,
Gianluca. (l'Aquila tornerà a volare alta nel cielo!!!!)

Moru

If possible I too would love to be able to set alpha per polyvector point instead, that would be very nice.