GLBasic forum

Codesnippets => 2D-snippets => Topic started by: bigsofty on 2012-Apr-18

Title: Retro Xor Mode
Post by: bigsofty on 2012-Apr-18
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

Title: Re: Retro Xor Mode
Post by: I love my Brick on 2012-Apr-18
Thanks for that. I often used XOR in the old, humble CPC days.
Title: Re: Retro Xor Mode
Post by: Minion on 2012-Apr-18
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
Title: Re: Retro Xor Mode
Post by: mentalthink on 2012-Apr-27
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...