Author Topic: Retro Xor Mode  (Read 1615 times)

Offline bigsofty

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 2470
    • View Profile
Retro Xor Mode
« 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
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)

Offline I love my Brick

  • Mr. Drawsprite
  • **
  • Posts: 61
    • View Profile
Re: Retro Xor Mode
« Reply #1 on: 2012-Apr-18 »
Thanks for that. I often used XOR in the old, humble CPC days.
I like things and do stuff.

Offline Minion

  • Mr. Polyvector
  • ***
  • Posts: 228
    • View Profile
Re: Retro Xor Mode
« Reply #2 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

Offline mentalthink

  • Prof. Inline
  • *****
  • Posts: 3328
  • Integrated Brain
    • View Profile
Re: Retro Xor Mode
« Reply #3 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...