Graphics Programming
TVP4020
Programmers Reference Manual
50
Pseudocode for the above example is:
// Set the Rasterizer mode to the default, see
// §5.3.11
RasterizerMode (0)
// Set-up the start values and the deltas.
// Note that the X and Y coordinates are converted to
// 16.16 format
StartXDom (X1<<16)
dXDom (((X3- X1)<<16)/(Y3 - Y1))
StartXSub (X1<<16)
dXSub (((X2- X1)<<16)/(Y2 - Y1))
StartY (Y1<<16)
dY (-1<<16)
// Down the screen
Count (Y1 - Y2)
// Set the render mode to aliased primitive with
// subpixel correction. See §5.3.7
render.PrimitiveType = PERMEDIA_TRAPEZOID_PRIMITIVE
render.SubpixelCorrectionEnable = PERMEDIA_TRUE
// Draw top half of the triangle
Render (render)
// Set the start and delta for the second half of the
// triangle.
StartXSub (X2<<16)
dXSub (((X3- X2)<<16)/(Y3 - Y2))
// Draw lower half of triangle
ContinueNewSub (abs(Y2 - Y3))
After the Render command has been sent, the registers in P
ERMEDIA
can
immediately be altered to draw the second half of the triangle. For this,
note that only two registers need be loaded and the command
ContinueNewSub be sent. Once drawing of the first triangle is complete
and P
ERMEDIA
has received the ContinueNewSub command, drawing of
this sub-triangle will start. The ContinueNewSub command register is
loaded with the remaining number of scanlines to be rendered.
A Continue command can be used instead of the ContinueNewSub
command in certain situations where it is beneficial to avoid reloading
Summary of Contents for TVP4020 PERMEDIA 2
Page 1: ...Texas Instruments TVP4020 PERMEDIA 2 Programmer s Reference Manual Issue 4 ...
Page 284: ...TVP4020 Programmers Reference Manual A Gouraud Shaded Triangle 275 ...
Page 292: ...TVP4020 Programmers Reference Manual Register Tables 283 ...
Page 314: ...TVP4020 Programmers Reference Manual Index 305 ...
Page 315: ...Index TVP4020 Programmers Reference Manual 306 Index ...
Page 323: ...Index TVP4020 Programmers Reference Manual 314 ...