Retro Xor Mode

Previous topic - Next topic

bigsofty

This was create to answer this thread, http://www.glbasic.com/forum/index.php?topic=7801.0;topicseen

Posted it here in case it was of use to someone else.

Its a very simple way to create a sprite (see here... http://tibasicdev.wikidot.com/68k:sprites )

You will need the "gl.gbas" that ships with GLBasic.

Code (glbasic) Select
// Xor mode, on/off sample

LOCAL i%

WHILE 1=1

GLXOR(TRUE) // On

FOR i%=0 TO 999
DRAWLINE RND(640),RND(480),RND(640),RND(480),RGB(255,255,255)
NEXT

GLXOR(FALSE) // Off

SHOWSCREEN

MOUSEWAIT

WEND


FUNCTION GLXOR: xorFlg%
IF xorFlg%
glEnable(GL_COLOR_LOGIC_OP)
glLogicOp(GL_XOR)
ELSE
glDisable(GL_COLOR_LOGIC_OP)
ENDIF
ENDFUNCTION

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)

I love my Brick

Thanks for that. I often used XOR in the old, humble CPC days.
I like things and do stuff.

Minion

Thought Id add this , don`t feel it deserves its own thread, but someone else may find this usefull/ handy

glColorMask(red, green, blue, alpha)

Allows you to enable/disable which colours are used in graphics ops, so glColorMask(1,1,1,0) would turn off all subsequent transparency, glColorMask(0,1,1,1) would only display the green and blue component of the graphics etc

mentalthink

Thanks Bigsofty, this info it´s very usefull I always askme about how make the mask and this things... I think this goes wewll for my CPC projects... almost I know a little about the theme...

Thanks in adavance...