DECLARE SUB DQBgtri (BYVAL Layer, BYVAL x1, BYVAL y1, BYVAL c1, BYVAL x2,
BYVAL y2, BYVAL c2, BYVAL x3, BYVAL y3, BYVAL c3)
Layer - Layer where to draw the triangle
x1 - x coordinate of the first vertex
y1 - y coordinate of the first vertex
c1 - color of the first vertex
x2 - x coordinate of the second vertex
y2 - y coordinate of the second vertex
c2 - color of the second vertex
x3 - x coordinate of the third vertex
y3 - y coordinate of the third vertex
c3 - color of the third vertex
none
Draws a gouraud-shaded triangle with (x1,y1), (x2,y2) and (x3,y3) as vertex, interpolating specified colors, using the current palette. DQBgtri does not support transparency, but it's affected by the clipping box.
Gouraud shading works better when you set a palette with lots of shades of the same color; it is up to you to find the best settings for your needs. See also DQBtri, DQBbtri, DQBttri
*****************************************************************************
' All integers for speed
DEFINT A-Z
'$INCLUDE:'DIRECTQB.BI'
' Let's initialize the library with no extra layers nor sounds nor EMS
IF DQBinit(0, 0, 0) THEN DQBclose: PRINT DQBerror$: END
DQBinitVGA
' Sets up the palette with shades of red
FOR i = 0 TO 63
DQBsetCol i, i, 0, 0
DQBsetCol 64 + i, 63, i, i
NEXT i
' Draws 500 gouraud-shaded triangles; uses only the first 128 colors we set
FOR i = 1 TO 500
DQBgtri VIDEO, (RND * 320), (RND * 200), (RND * 128), (RND * 320), (RND * 200), (RND * 128), (RND * 320), (RND * 200), (RND * 128)
NEXT i
' Waits for the user to press a key
WHILE INKEY$ = "": WEND
' Ends program
DQBclose
*****************************************************************************