• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1Name
2
3    NV_texture_border_clamp
4
5Name Strings
6
7    GL_NV_texture_border_clamp
8
9Contributors
10
11     Jussi Rasanen, NVIDIA
12     Greg Roth, NVIDIA
13
14Contact
15
16    Greg Roth, NVIDIA (groth 'at' nvidia 'dot' com)
17
18Status
19
20    Complete
21
22Version
23
24    Date: Aug 24, 2012
25    Revision: 2
26
27Number
28
29    OpenGL ES Extension #149
30
31Dependencies
32
33    OpenGL ES 2.0 is required.
34
35    This extension is written against the OpenGL ES 2.0.25
36    specification.
37
38    OES_texture_3D affects the definition of this extension.
39
40Overview
41
42    OpenGL ES provides only a single clamping wrap mode: CLAMP_TO_EDGE.
43    However, the ability to clamp to a constant border color can be
44    useful to quickly detect texture coordinates that exceed their
45    expected limits or to dummy out any such accesses with transparency
46    or a neutral color in tiling or light maps.
47
48    This extension defines an additional texture clamping algorithm.
49    CLAMP_TO_BORDER_NV clamps texture coordinates at all mipmap levels
50    such that NEAREST and LINEAR filters of clamped coordinates return
51    only the constant border color. This does not add the ability for
52    textures to specify borders using glTexImage2D, but only to clamp
53    to a constant border value set using glTexParameter.
54
55New Procedures and Functions
56
57    None.
58
59New Tokens
60
61    Accepted by the <pname> parameter of TexParameteri, TexParameterf,
62    TexParameteriv, and TexParameterfv:
63
64        TEXTURE_BORDER_COLOR_NV                         0x1004
65
66    Accepted by the <param> parameter of TexParameteri and
67    TexParameterf, and by the <params> parameter of TexParameteriv and
68    TexParameterfv, and returned by the <params> parameter of
69    GetTexParameteriv and GetTexParameterfv when their <pname> parameter
70    is TEXTURE_WRAP_S, TEXTURE_WRAP_T, or TEXTURE_WRAP_R_OES:
71
72        CLAMP_TO_BORDER_NV                              0x812D
73
74Additions to Chapter 3 of the OpenGL ES 2.0.25 Specification
75(Rasterization)
76
77    Modify Section 3.7.4 "Texture Parameters"
78
79    Append to the end of the first paragraph:
80
81    If the values for TEXTURE_BORDER_COLOR_NV are specified as integers,
82    they are converted to floating-point as described in section 2.1.2.
83    Each of the four values set by TEXTURE_BORDER_COLOR_NV is clamped to
84    lie in [0, 1].
85
86    Modify Table 3.10, edit the following lines:
87
88    Name                    Type      Legal Values
89    ==============          =======   ====================
90    TEXTURE_WRAP_S          integer   CLAMP_TO_EDGE, REPEAT, MIRRORED_REPEAT,
91                                      CLAMP_TO_BORDER_NV
92    TEXTURE_WRAP_T          integer   CLAMP_TO_EDGE, REPEAT, MIRRORED_REPEAT,
93                                      CLAMP_TO_BORDER_NV
94    TEXTURE_WRAP_R_OES      integer   CLAMP_TO_EDGE, REPEAT, MIRRORED_REPEAT,
95                                      CLAMP_TO_BORDER_NV
96
97    and add:
98
99    Name                    Type      Legal Values
100    ==============          =======   ====================
101    TEXTURE_BORDER_COLOR_NV 4 floats  any 4 values in {0,1}
102
103    Modify Section 3.7.6 "Texture Wrap Modes"
104
105    Add after wrap mode CLAMP_TO_EDGE:
106
107    Wrap Mode CLAMP_TO_BORDER_NV
108
109    CLAMP_TO_BORDER_NV clamps texture coordinates at all mipmaps such
110    that the texture filter always samples the constant border color for
111    fragments whose corresponding texture coordinate is sufficiently far
112    outside the range [0, 1].  The color returned when clamping is
113    derived only from the constant border color.
114
115    Texture coordinates are clamped to the range [min, max]. The minimum
116    value is defined as
117
118        min = -1 / 2N
119
120    where N is the size of the one-, two-, or three-dimensional texture
121    image in the direction of clamping.  The maximum value is defined as
122
123        max = 1 - min
124
125    so that clamping is always symmetric about the [0,1] mapped range of
126    a texture coordinate.
127
128    Modify Section 3.7.7 "Texture Minification"
129
130    Add to the end of Subsection "Scale Factor and Level of Detail"
131
132    If any of the selected Tijk or Tij in the above equations refer to a
133    border texel with i < 0, j < 0, k < 0, i >= ws, j >= hs, or k >= ds,
134    then the border values defined by TEXTURE_BORDER_COLOR_NV are used
135    instead of the unspecified value or values. If the texture contains
136    color components, the values of TEXTURE_BORDER_COLOR_NV are
137    interpreted as an RGBA color to match the texture's internal format
138    in a manner consistent with table 3.8. If the texture contains depth
139    components, the first component of TEXTURE_BORDER_COLOR_NV is
140    interpreted as a depth value.
141
142    Modify Section 3.7.12 "Texture state"
143
144    Modify the last two sentences of the section:
145
146    Next, there are the two sets of texture properties; each consists
147    of the selected minification and magnification filters, the wrap
148    modes for s, t, and r, and the TEXTURE_BORDER_COLOR_NV. In the
149    initial state, the value assigned to TEXTURE_MIN_FILTER is NEAREST_-
150    MIPMAP_LINEAR, and the value for TEXTURE_MAG_FILTER is LINEAR. s, t,
151    and r wrap modes are all set to REPEAT, and TEXTURE_BORDER_COLOR_NV
152    is (0,0,0,0).
153
154Errors
155
156    None.
157
158New State
159
160    Modify table 6.8:
161
162    Change the type information changes for these parameters.
163                                                                Initial
164    Get Value                 Type   Get Command      Value   Description    Sec.
165    ---------                 ------ -----------      ------- -----------    ----
166    TEXTURE_WRAP_S            n x Z4 GetTexParameter  REPEAT  Texture wrap   3.7
167    TEXTURE_WRAP_T            n x Z4 GetTexParameter  REPEAT  Texture wrap   3.7
168    TEXTURE_WRAP_R_OES        n x Z4 GetTexParameter  REPEAT  Texture wrap   3.7
169
170    Add the following parameter:
171
172    Get Value                 Type   Get Command      Value   Description    Sec.
173    ---------                 ------ -----------      ------- -----------    ----
174    TEXTURE_BORDER_COLOR_NV   2+ x C GetTexParameter  0,0,0,0 Texture border 3.7
175
176Dependencies on OES_texture_3D
177
178    If OES_texture_3D is not supported, ignore all references to
179    three-dimensional textures and token TEXTURE_WRAP_R_OES as well
180    as any reference to r wrap modes.  References to Tijk, k, and ds in
181    section 3.7.6 should also be removed.
182
183Issues
184
185    None
186
187Revision History
188
189    Rev.    Date       Author       Changes
190    ----   --------    ---------    -------------------------------------
191     4     04 Sep 2012 groth        Restored langauge in 3.7.7 about texture borders
192     3     29 Aug 2012 groth        Minor copy edits.
193     2     24 Aug 2012 groth        Clarified constant color language and tex_3d dependency
194     1     14 Aug 2012 groth        Initial draft based off ARB_texture_border_clamp
195
196