BASIC

Author Topic: POLYVECTOR UVs  (Read 4070 times)

Offline bigsofty

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 2542
    • View Profile
POLYVECTOR UVs
« 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
« Last Edit: 2011-Apr-07 by bigsofty »
Cheers,

Ian.

“It is practically impossible to teach good programming style to students that have had prior exposure to BASIC.  As potential programmers, they are mentally mutilated beyond hope of regeneration.”
(E. W. Dijkstra)

Offline Kitty Hello

  • code monkey
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 10661
  • here on my island the sea says 'hello'
    • View Profile
    • http://www.glbasic.com
Re: POLYVECTOR UVs
« Reply #1 on: 2011-Apr-07 »
well, just use GETSPRITESIZE and multiply with this value.
Wrapping is possible.

Offline bigsofty

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 2542
    • View Profile
Re: POLYVECTOR UVs
« Reply #2 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
Cheers,

Ian.

“It is practically impossible to teach good programming style to students that have had prior exposure to BASIC.  As potential programmers, they are mentally mutilated beyond hope of regeneration.”
(E. W. Dijkstra)

Offline spicypixel

  • Prof. Inline
  • *****
  • Posts: 646
  • Pixel Artist
    • View Profile
    • SpicyPixel.net
Re: POLYVECTOR UVs
« Reply #3 on: 2011-Oct-16 »
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?
http://www.spicypixel.net | http://www.facebook.com/SpicyPixel.NET

Comps Owned - ZX.81, ZX.48K, ZX.128K+2, Vic20, C64, Atari-ST, A500.600.1200, PC, Apple Mini-Mac.

Offline Moebius

  • Dr. Type
  • ****
  • Posts: 315
    • View Profile
Re: POLYVECTOR UVs
« Reply #4 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
« Last Edit: 2011-Oct-16 by Serpent »
Endless Loop: n., see Loop, Endless.
Loop, Endless: n., see Endless Loop.
- Random Shack Data Processing Dictionary

Offline spicypixel

  • Prof. Inline
  • *****
  • Posts: 646
  • Pixel Artist
    • View Profile
    • SpicyPixel.net
Re: POLYVECTOR UVs
« Reply #5 on: 2011-Oct-16 »
Thank you very much  :good:
http://www.spicypixel.net | http://www.facebook.com/SpicyPixel.NET

Comps Owned - ZX.81, ZX.48K, ZX.128K+2, Vic20, C64, Atari-ST, A500.600.1200, PC, Apple Mini-Mac.

Offline spicypixel

  • Prof. Inline
  • *****
  • Posts: 646
  • Pixel Artist
    • View Profile
    • SpicyPixel.net
Re: POLYVECTOR UVs
« Reply #6 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 ;)
http://www.spicypixel.net | http://www.facebook.com/SpicyPixel.NET

Comps Owned - ZX.81, ZX.48K, ZX.128K+2, Vic20, C64, Atari-ST, A500.600.1200, PC, Apple Mini-Mac.

Offline Moebius

  • Dr. Type
  • ****
  • Posts: 315
    • View Profile
Re: POLYVECTOR UVs
« Reply #7 on: 2011-Oct-16 »
iOS, Android, Windows and Mac (AFAIK) work - haven't tried WinCE...
Endless Loop: n., see Loop, Endless.
Loop, Endless: n., see Endless Loop.
- Random Shack Data Processing Dictionary

Offline Kitty Hello

  • code monkey
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 10661
  • here on my island the sea says 'hello'
    • View Profile
    • http://www.glbasic.com
Re: POLYVECTOR UVs
« Reply #8 on: 2011-Oct-17 »
Works for all.