Can someone explain the usage situations for Polyvector and Newpolystrip

Previous topic - Next topic

MrPlow

I am seeing that polyvector / newpolystrip can be useful and is used a lot but I dont yet fully understand what they are good for.
Are they for drawing only or other uses also...

Comp:
Speccy-48k, Speccy-128k, Amigas, PCs

mentalthink

HI MrPlow, a Polyvecto how you say it´s like a Drawsprite, but you can make a lot of thing whit them, in example:

You can make a shape whit the form waht do you want, don´t have be precisely a rectangle, can be a hexangon a triangle, or any shape what do you want draw.

Another point you can turn in any direction, and whit a little effort, you can make something effect like 3D.

Another point it´s the vertex can be additional color, in some corner of your polysprite can be red, and another point blue.

This it´s important, the polyvector have have UVMap corrdinates, this permet to put a image part, in the part of polyvector do you want, in example in a rectagle whit polyvector you can do a zoom, but the polyvector have the same size, only the image it´s amplied, not it´s like zoomSprite.

Another utilities, imagine you can do a ripple water effect, whot polyvector you can do it, or somthing efect like wind in a Flag, it´s easy, and don´t need a lot of CPU.

I hope help in something, and welcome to the Forum.

Kinds Regards,
Iván J

ampos

Each polyvector/endpolyvector is drawn by the gfx chip just like a single draw/sprite.

If you use newpolystrep, is like drawing another sprite without calling another draw call in opengl. So, you ended drawing many sprites with just a single draw blit by the gfx chip.

As far as I understand, to get this improvement, the polyvector sprite sheet has to be just one, so it will draw a full background tiles with the speed of a single gfx call if all the gfx tiles are on the same sprite sheet.

Or perhaps I am wrong :D
check my web and/or my blog :D
http://diniplay.blogspot.com (devblog)
http://www.ampostata.org
http://ampostata.blogspot.com
I own PC-Win, MacBook 13", iPhone 3G/3GS/4G and iPAC-WinCE

Slydog

Polyvectors are triangular graphics of any size or shape.
To mimic a traditional sprite, you place two triangle polyvectors together shaped like a rectangle.
Polyvectors have modes to make this easier, such as the 'strip' mode where each new point drawn is connected to the previous points to complete a new triangle. 

They don't have to end up rectangular, but this is how they are used 99% of the time.
You could easily have a large triangle, or very odd shape composed of triangles, much like a 3D model.

As ampos mentioned, the main advantage is speed.  Used with sprite sheets / texture atlases, you can lower your overall OpenGL draw calls significantly.  With traditional sprites, each sprite causes OpenGL to 'lift its pen' (ie. a new draw call) to start displaying the new one.  But polyvector sprites that share a sprite sheet, and use the POLYNEWSTRIP command, can allow OpenGL to keep its pen down for the entire series of poly sprites.  If all of your sprites are in the same file, in theory you could draw your entire game scene with one draw call.

The 2nd feature is each corner of the poly sprite can have it's own colour for effects like gradient blends, fake dynamic lighting, etc.  Or to just plot the entire poly sprite with a different shade.  If you draw your sprite in grey scale in your graphics program, you can plot it in any colour or shade in your game.  Great for drawing background tiles at different shades to reduce the tiled look.  However it's been mentioned that any colour but white (white means use original colour from sprite file) slows down on some portable devices, so use this feature sparingly if targeting these.

I've seen code that uses the polyvector concept to mimic a wobble / ripple screen effect.  Draw your game scene as normal and just before displaying, sub-divide the final screen image into small rectangles and skew the coordinates appropriately for the ripple effect.  Check out these links to see what I mean:
http://www.amusedsloth.com/2011/01/screen-space-deformations-in-xna-for-windows-phone-7/
http://jonathan.dickinsons.co.za/blog/2011/01/versatile-distortions-in-xna/
My current project (WIP) :: TwistedMaze <<  [Updated: 2015-11-25]

MrPlow

Thanks guys...wow!
I need to look into that Poly-ma-thingy!

Like the robot from that spill'berg film said... "...need more input!"
:enc:
Comp:
Speccy-48k, Speccy-128k, Amigas, PCs