1Name 2 3 EXT_stencil_wrap 4 5Name Strings 6 7 GL_EXT_stencil_wrap 8 9Contact 10 11 Dale Kirkland, NVIDIA (dkirkland 'at' nvidia.com) 12 13Status 14 15 Shipping 16 17Version 18 19 Date: 4/4/2002 Version 1.2 20 21Number 22 23 176 24 25Dependencies 26 27 None 28 29Overview 30 31 Various algorithms use the stencil buffer to "count" the number of 32 surfaces that a ray passes through. As the ray passes into an object, 33 the stencil buffer is incremented. As the ray passes out of an object, 34 the stencil buffer is decremented. 35 36 GL requires that the stencil increment operation clamps to its maximum 37 value. For algorithms that depend on the difference between the sum 38 of the increments and the sum of the decrements, clamping causes an 39 erroneous result. 40 41 This extension provides an enable for both maximum and minimum wrapping 42 of stencil values. Instead, the stencil value wraps in both directions. 43 44 Two additional stencil operations are specified. These new operations 45 are similiar to the existing INCR and DECR operations, but they wrap 46 their result instead of saturating it. This functionality matches 47 the new stencil operations introduced by DirectX 6. 48 49New Procedures and Functions 50 51 None 52 53New Tokens 54 55 Accepted by the <sfail>, <dpfail>, and <dppass> parameter of 56 StencilOp: 57 58 INCR_WRAP_EXT 0x8507 59 DECR_WRAP_EXT 0x8508 60 61Additions to Chapter 2 of the GL Specification (OpenGL Operation) 62 63 None 64 65Additions to Chapter 3 of the GL Specification (Rasterization) 66 67 None 68 69Additions to Chapter 4 of the GL Specification (Per-Fragment Operations 70and the Framebuffer) 71 72 Section 4.1.4 "Stencil Test" (page 144), change the 3rd paragraph to read: 73 74 "... The symbolic constants are KEEP, ZERO, REPLACE, INCR, DECR, 75 INVERT, INCR_WRAP_EXT, and DECR_WRAP_EXT. The correspond to 76 keeping the current value, setting it to zero, replacing it with 77 the reference value, incrementing it with saturation, decrementing 78 it with saturation, bitwise inverting it, incrementing it without 79 saturation, and decrementing it without saturation. For purposes of 80 incrementing and decrementing, the stencil bits are considered as an 81 unsigned integer. Incrementing or decrementing with saturation will 82 clamp values at 0 and the maximum representable value. Incrementing 83 or decrementing without saturation will wrap such that incrementing 84 the maximum representable value results in 0 and decrementing 0 85 results in the maximum representable value. ..." 86 87Additions to Chapter 5 of the GL Specification (Special Functions) 88 89 None 90 91Additions to Chapter 6 of the GL Specification (State and State Requests) 92 93 None 94 95Additions to the GLX Specification 96 97 None 98 99GLX Protocol 100 101 None 102 103Errors 104 105 INVALID_ENUM is generated by StencilOp if any of its parameters 106 are not KEEP, ZERO, REPLACE, INCR, DECR, INVERT, INCR_WRAP_EXT, 107 or DECR_WRAP_EXT. 108 109New State 110 111(table 6.15, page 205) 112 Get Value Type Get Command Initial Value Sec Attribute 113 ------------------------ ---- ------------ ------------- ----- --------- 114 STENCIL_FAIL Z8 GetIntegerv KEEP 4.1.4 stencil-buffer 115 STENCIL_PASS_DEPTH_FAIL Z8 GetIntegerv KEEP 4.1.4 stencil-buffer 116 STENCIL_PASS_DEPTH_PASS Z8 GetIntegerv KEEP 4.1.4 stencil-buffer 117 118NOTE: the only change is that Z6 type changes to Z8 119 120New Implementation Dependent State 121 122 None 123 124Revision History 125 126 * Revision 1.2, April 4, 2002 - correct typo in New Tokens section. 127 These are parameters to StencilOp, not BlendEquation. 128