Main sections
POLYVECTOR
POLYVECTOR x%, y%, tx%, ty%, col%
POLYVECTOR is used to specify the location of a point for a polygon being created by STARTPOLY.
Color values can be set for each polygon's corner. There have to be at least 3 POLYVECTOR calls in-between STARTPOLY and ENDPOLY otherwise no area has been specified and nothing will be drawn. In the current version, GLBasic will draw front and back faces of triangles (X_CULLMODE 0).
o x% and y% are the screen coordinate of the vector.
Please pay attention that polygons must be entered anti-clockwise.
o tx% and ty% gives the x and y coordinates on the bitmap spriteID% for the texture's pixels.
o col% is a RGB( ) color value that colors corners in addition to the bitmap texture.
Using RGB(255, 255, 255) (White) for col% means that the texture color will not be changed.
o iMode specifies what type of triangles will be drawn.
Mode = 0 (FAN)
All points will be connected to the first one.
1_____0______4
\ / \ /
\ / \ /
\/_____\/
2 3
Mode = 1 (TRINGLES)
Each set of 3 points form a separate triangle.
1_____0 3______5
\ / \ /
\ / \ /
\/ \/
2 4
Mode = 1 (STRIP)
Each 2 points form a quadrilateral
0_____2______4
\ / \ /
\ / \ /
\/_____\/
1 3
Sample:
// POLYSPRITES
LOADSPRITE "Block.bmp", 0 // 64x64 Bitmap
LOADBMP "Test.bmp"
STARTPOLY 0 // 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( 0, 255, 0)
ENDPOLY
SHOWSCREEN
MOUSEWAIT