GLLOGICOP(3G)
π 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, andGL_OR_INVERTED. the initial value isGL_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_ENUMis generated ifopcodeis not an accepted value. so pick from the list, don't freestyle π«GL_INVALID_OPERATIONis generated ifglLogicOpis executed between the execution ofglBeginand the corresponding execution ofglEnd. nope, not in there, not the moment π ββοΈ
π ASSOCIATED GETS π
glGetwith argumentGL_LOGIC_OP_MODE.glIsEnabledwith argumentGL_COLOR_LOGIC_OPorGL_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
- opensuse-leap 16.0: Mesa-libGL-devel 24.1.7-160000.3.1 Β· MIT
- opensuse-leap 16.0: Mesa-libGL-devel 24.3.3-160000.3.1 Β· MIT
- opensuse-leap 16.0: Mesa-libGL-devel 24.3.3-160000.3.1 Β· MIT
- opensuse-leap 16.0: Mesa-libGL-devel 24.3.3-160000.3.1 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms