GLLOGICOP(3G)

πŸ“¦ version 24.3.3, in opensuse-leap 16.0

πŸ’… GLLOGICOP(3G) β€” like, the whole manual page, bestie

okay so before we even start: this is from the 3G manual (the OpenGL girlies), and the page is GLLOGICOP. we're talking bitwise pixel math and honestly? it ate. let's go πŸŽ€


✨ NAME ✨

glLogicOp β€” specify a logical pixel operation for color index rendering πŸ–ŒοΈ


🌸 C SPECIFICATION 🌸

void glLogicOp( GLenum opcode )

πŸ¦‹ PARAMETERS πŸ¦‹

  • opcode β€” a symbolic constant that picks which logical operation you want, babes. the accepted symbols are, in order: GL_CLEAR, GL_SET, GL_COPY, GL_COPY_INVERTED, GL_NOOP, GL_INVERT, GL_AND, GL_NAND, GL_OR, GL_NOR, GL_XOR, GL_EQUIV, GL_AND_REVERSE, GL_AND_INVERTED, GL_OR_REVERSE, and GL_OR_INVERTED. the initial value is GL_COPY. periodt πŸ’…

πŸ’– DESCRIPTION πŸ’–

glLogicOp sets up a logical operation that β€” when it's enabled β€” gets applied between the incoming color index or RGBA color and the color index or RGBA color sitting at the corresponding location in the frame buffer. like, a lil meet-cute between source and destination 🌈

to turn the logical operation on or off, you call glEnable and glDisable with the symbolic constant GL_COLOR_LOGIC_OP for RGBA mode, or GL_INDEX_LOGIC_OP for color index mode. the initial value is disabled for both operations. no cap, it starts off ✨off✨.

here's the whole menu of opcodes, mwah πŸ’‹:

Opcode             Resulting Operation
───────────────────────────────────────
GL_CLEAR                    0
GL_SET                      1
GL_COPY                     s
GL_COPY_INVERTED           ~s
GL_NOOP                     d
GL_INVERT                  ~d
GL_AND                    s & d
GL_NAND                 ~(s & d)
GL_OR                     s | d
GL_NOR                  ~(s | d)
GL_XOR                    s ^ d
GL_EQUIV                ~(s ^ d)
GL_AND_REVERSE           s & ~d
GL_AND_INVERTED          ~s & d
GL_OR_REVERSE            s | ~d
GL_OR_INVERTED           ~s | d
───────────────────────────────────────

so opcode is a symbolic constant chosen from that list up there. in the explanation of the logical operations, s represents the incoming color index and d represents the index in the frame buffer. standard C-language operators are used β€” so like, &, |, ^, ~, the whole squad. and the way these bitwise operators suggest, the logical operation is applied independently to each bit pair of the source and destination indices or colors 🧚


🫢 NOTES 🫢

  • color index logical operations are always supported. always always. πŸ’―
  • RGBA logical operations are supported only if the GL version is 1.1 or greater. so check that version first, bestie, don't embarrass yourself πŸ™ˆ
  • when more than one RGBA color or index buffer is enabled for drawing, logical operations are performed separately for each enabled buffer, using for the destination value the contents of that buffer (see glDrawBuffer). one vibe per buffer, iykyk πŸ’«

πŸ’€ ERRORS πŸ’€

  • GL_INVALID_ENUM is generated if opcode is not an accepted value. so pick from the list, don't freestyle 🚫
  • GL_INVALID_OPERATION is generated if glLogicOp is executed between the execution of glBegin and the corresponding execution of glEnd. nope, not in there, not the moment πŸ™…β€β™€οΈ

πŸ‘‘ ASSOCIATED GETS πŸ‘‘

  • glGet with argument GL_LOGIC_OP_MODE.
  • glIsEnabled with argument GL_COLOR_LOGIC_OP or GL_INDEX_LOGIC_OP.

⭐ SEE ALSO ⭐

glAlphaFunc(3G), glBlendFunc(3G), glDrawBuffer(3G), glEnable(3G), glStencilOp(3G)


and that's the whole page, bestie πŸ“ the footer is literally just GLLOGICOP(3G) β€” no date, no source line, just the name again like a signature serve. iconic minimalism, we respect it πŸ’œ go forth and bitwise-operate responsibly πŸŽ€βœ¨

πŸ“¦ where this page comes from