GLBasic forum

Feature request => 2D => Topic started by: bigsofty on 2011-Apr-07

Title: POLYVECTOR UVs
Post by: bigsofty on 2011-Apr-07
Create a new POLYVECTOR command/flag that uses proper UV texture (0..1) coordinates, instead of pixel based ones. This would allow for higher res graphics to be used without needing to change code. Scaling between resolutions/platforms would be easier as the UVs would not need to be changed. Also would allow for texture wrapping (UVs > 1).

Obviously not ideal for all occasions but it would add more flexibility to the current command. Maybe an optional flag/new command?

Cheers,


Ian
Title: Re: POLYVECTOR UVs
Post by: Kitty Hello on 2011-Apr-07
well, just use GETSPRITESIZE and multiply with this value.
Wrapping is possible.
Title: Re: POLYVECTOR UVs
Post by: bigsofty on 2011-Apr-07
Cool, that's a nice tip Gernot, I never realised that if you put a texture coord outside the the texture range in POLYVECTOR it wraps! :D

Cheers,


Ian
Title: Re: POLYVECTOR UVs
Post by: spicypixel on 2011-Oct-16
Quote from: bigsofty on 2011-Apr-07
Create a new POLYVECTOR command/flag that uses proper UV texture (0..1) coordinates, instead of pixel based ones. This would allow for higher res graphics to be used without needing to change code. Scaling between resolutions/platforms would be easier as the UVs would not need to be changed. Also would allow for texture wrapping (UVs > 1).

Obviously not ideal for all occasions but it would add more flexibility to the current command. Maybe an optional flag/new command?

Cheers,


Ian

I actually messed about with PolyVectors before and achieved the tiling effect when I was trying to scale an image up. Now I actually want the tiling effect but cannot work out the PV commands to do it lol :) Anyone?
Title: Re: POLYVECTOR UVs
Post by: Moebius on 2011-Oct-16
For tiling, just set the texture coordinates to be greater than the size of the image.  (If I remember correctly, this only works 'properly' with power of 2 image sizes, otherwise you get borders in between tiles.)  You can even have negative texture coordinates.
e.g. to tile an image across the screen  :good:
Code (glbasic) Select
CONSTANT Width = 800, Height = 600
STARTPOLY 123, 2
   POLYVECTOR 0, 0, 0, 0
   POLYVECTOR Width, 0, Width, 0
   POLYVECTOR 0, Height, 0, Height
   POLYVECTOR Width, Height, Width, Height
ENDPOLY
Title: Re: POLYVECTOR UVs
Post by: spicypixel on 2011-Oct-16
Thank you very much  :good:
Title: Re: POLYVECTOR UVs
Post by: spicypixel on 2011-Oct-16
Any confirmation of what platforms it does work on. I'm really only interested in iOS and Android but can test those myself. But cheers for the heads up Ocean ;)
Title: Re: POLYVECTOR UVs
Post by: Moebius on 2011-Oct-16
iOS, Android, Windows and Mac (AFAIK) work - haven't tried WinCE...
Title: Re: POLYVECTOR UVs
Post by: Kitty Hello on 2011-Oct-17
Works for all.