Different behaviour for POLYVECTOR, DRAWRECT and SETPIXEL

Previous topic - Next topic

Ruidesco

This is probably not something important, but it's a difference in behaviour that had me scratching my head for a good while.
Code (glbasic) Select
LOCAL colorData[]; DIMDATA colorData[], 0xffffff, 0, 0xff, 0xffff, 0xff00, 0xffff00, 0xff0000, 0xff00ff
LOCAL x, y, c
LOCAL size = 8, shift = 88, y2 = 16, y3 = 32

FOR c = 0 TO LEN(colorData[]) - 1

STARTPOLY

POLYVECTOR shift + c * size + size, 0, 0, 0, colorData[c]
POLYVECTOR shift + c * size, 0, 0, 0, colorData[c]
POLYVECTOR shift + c * size, size, 0, 0, colorData[c]
POLYVECTOR shift + c * size + size, size, 0, 0, colorData[c]

ENDPOLY

DRAWRECT shift + c * size, y2, size, size, colorData[c]

FOR x = 0 TO size - 1
FOR y = 0 TO size - 1
SETPIXEL shift + x + (c * size), y3 + y, colorData[c]
NEXT
NEXT

NEXT

PRINT "POLYVECTOR", 0, 0
PRINT "DRAWRECT", 0, y2
PRINT "SETPIXEL", 0, y3

SHOWSCREEN; KEYWAIT; END

This is just a dummy code that draws the same series of coloured squares using POLYVECTOR, DRAWRECT and SETPIXEL. While I would have expected any method to be the same, their output varied:


MrTAToad

I get this :

Is your graphics card set to anti-alias 2d graphics ?

[attachment deleted by admin]

Ruidesco

Heh, right on the spot.

This video card control panel is pretty simple (ATI's Catalyst Pro): the 3d graphics quality slider was set to optimal quality.
Setting it to balanced (or a lower setting) makes every square be drawn sharp.
Setting it to high quality, though, makes just DRAWRECT behave oddly:



It will probably make no difference in a real life application, though it's something to take into account if your graphics are being odd for some reason.

Thanks MrTAToad!

MrTAToad

It could also affect GETPIXEL/SPRCOLL too...

Ruidesco

Well yes, it will indirectly affect GETPIXEL, GRABSPRITE and other functions that rely on screen data. At the very least we know that POLYVECTOR draws sharp orthogonal lines no matter the settings.

MrTAToad