1GLLOGICOP(3G) GLLOGICOP(3G)
2
3
4
6 glLogicOp - specify a logical pixel operation for color index rendering
7
8
10 void glLogicOp( GLenum opcode )
11
12
14 opcode Specifies a symbolic constant that selects a logical operation.
15 The following symbols are accepted: GL_CLEAR, GL_SET, GL_COPY,
16 GL_COPY_INVERTED, GL_NOOP, GL_INVERT, GL_AND, GL_NAND, GL_OR,
17 GL_NOR, GL_XOR, GL_EQUIV, GL_AND_REVERSE, GL_AND_INVERTED,
18 GL_OR_REVERSE, and GL_OR_INVERTED. The initial value is
19 GL_COPY.
20
22 glLogicOp specifies a logical operation that, when enabled, is applied
23 between the incoming color index or RGBA color and the color index or
24 RGBA color at the corresponding location in the frame buffer. To
25 enable or disable the logical operation, call glEnable and glDisable
26 using the symbolic constant GL_COLOR_LOGIC_OP for RGBA mode or
27 GL_INDEX_LOGIC_OP for color index mode. The initial value is disabled
28 for both operations.
29
30 ───────────────────────────────────────
31 Opcode Resulting Operation
32 ───────────────────────────────────────
33 GL_CLEAR 0
34 GL_SET 1
35 GL_COPY s
36 GL_COPY_INVERTED ~s
37 GL_NOOP d
38 GL_INVERT ~d
39 GL_AND s & d
40 GL_NAND ~(s & d)
41 GL_OR s | d
42 GL_NOR ~(s | d)
43 GL_XOR s ^ d
44 GL_EQUIV ~(s ^ d)
45 GL_AND_REVERSE s & ~d
46 GL_AND_INVERTED ~s & d
47 GL_OR_REVERSE s | ~d
48 GL_OR_INVERTED ~s | d
49 ───────────────────────────────────────
50
51 opcode is a symbolic constant chosen from the list above. In the
52 explanation of the logical operations, s represents the incoming color
53 index and d represents the index in the frame buffer. Standard C-lan‐
54 guage operators are used. As these bitwise operators suggest, the log‐
55 ical operation is applied independently to each bit pair of the source
56 and destination indices or colors.
57
59 Color index logical operations are always supported. RGBA logical oper‐
60 ations are supported only if the GL version is 1.1 or greater.
61
62 When more than one RGBA color or index buffer is enabled for drawing,
63 logical operations are performed separately for each enabled buffer,
64 using for the destination value the contents of that buffer (see
65 glDrawBuffer).
66
68 GL_INVALID_ENUM is generated if opcode is not an accepted value.
69
70 GL_INVALID_OPERATION is generated if glLogicOp is executed between the
71 execution of glBegin and the corresponding execution of glEnd.
72
74 glGet with argument GL_LOGIC_OP_MODE.
75 glIsEnabled with argument GL_COLOR_LOGIC_OP or GL_INDEX_LOGIC_OP.
76
78 glAlphaFunc(3G), glBlendFunc(3G), glDrawBuffer(3G), glEnable(3G),
79 glStencilOp(3G)
80
81
82
83 GLLOGICOP(3G)