1Name 2 3 SGIS_pixel_texture 4 5Name Strings 6 7 GL_SGIS_pixel_texture 8 9Version 10 11 Last Modified Date: July 15, 1998 12 Author Revision: $Header: //depot/main/doc/registry/extensions/SGI/pixel_texture.spec#14 $ 13 14Number 15 16 15 17 18Dependencies 19 20 None 21 22Overview 23 24 The geometry rasterization and pixel pipeline "convert to fragment" 25 stages each produce fragments. The fragments are processed by 26 a unified per fragment pipeline that begins with the application 27 of the texture to the fragment color. Because the pixel pipeline 28 shares the per fragment processing with the geometry pipeline, the 29 fragments produced by the pixel pipeline must have the same fields 30 as the ones produced by the geometry pipeline. When 31 pixel groups are being converted to fragments, the parts 32 of the fragment that aren't derived from the pixel groups 33 are taken from the associated values in the current raster position. 34 35 A fragment consists of x and y window coordinates and their 36 associated color value, depth value, and texture coordinates. 37 In the 1.1 OpenGL specification, when the pixel group is RGBA 38 the fragment color is always derived from the pixel group, 39 and the depth value and texture coordinates always come 40 from the raster position. 41 42 This extension provides a way to specify how the texture coordinates 43 of the fragments can be derived from RGBA pixel groups. When 44 this option is enabled, the source of the fragment color value 45 when the pixel group is RGBA can be specified to come from either 46 the raster position or the pixel group. 47 48 Deriving the fragment texture coordinates from the pixel group 49 effectively converts a color image into a texture coordinate image. 50 The multidimensional texture mapping lookup logic also makes this 51 extension useful for implementing multidimensional color lookups. 52 Multidimensional color lookups can be used to implement very 53 accurate color space conversions. 54 55 Deriving texture coordinates from the pixel groups in the pixel 56 pipeline introduces a problem with the lambda parameter in the 57 texture mapping equations. When texture coordinates are 58 being taken from the current raster position texture coordinates, 59 the texture coordinate values don't change from pixel to pixel, 60 and the equation for calculating lambda always produces zero. 61 Enabling pixel_texture introduces changes in the texture 62 coordinates from pixel to pixel which are not necessarily 63 meaningful for texture lookups. This problem is addressed 64 by specifying that lambda is always set to zero when pixel_texture 65 is enabled. 66 67Issues 68 69 * Why do we need the named param? 70 71 Originally the single mode parameter was sufficient to control 72 the fragment's color source. However, new extensions (currently 73 lod and bit and possibly more in the future) introduce 74 additional ways to manipulate the way pixel texture operates. 75 These extensions modify the behavior of functionality which 76 is orthogonal to the functionality modified by this extension, 77 so multiple pixel_texture parameters are needed. The named 78 parameter provides a way to set the multiple pixel_texture 79 parameters. 80 81 * Should LOD be supported? 82 83 This has been addressed by the GL_SGIX_pixel_texture_lod extension. 84 85 * The fragment color source can be viewed as having its own 86 distinct functionality separate from the role it plays in 87 PIXEL_TEXTURE_SGIS. Should it have its own extension? 88 89 No. 90 91 * We chose the name PixelTexGenParameterSGIS because PixelTexGenSGIX 92 has already been taken by the impact_pixel_texture extension. 93 Should the name be TexGenParam rather than PixelTexGenParam? 94 TexGenParam would then be used to expand either geometry texgen 95 functionality or pixel_texture functionality. Or can we get 96 away with using PixelTexGen{if}? 97 98 Use PixelTexGenParameteriSGIS and PixelTexGenParameterivSGIS. 99 100 * Should the PIXEL_TEXTURE_SGIS pipeline include a texture matrix? 101 102 No. The color matrix can be used if needed. 103 The texture matrix takes place during geometry rasterization -- 104 it's nice to keep that part of the pipeline separate 105 from the pixel part. 106 107 * Do we need to include PixelTexGenParameter{if}vSGIS to be 108 complete? 109 110 Yes. This will make things less confusing if future 111 extensions want to define a float named param. 112 113New Procedures and Functions 114 115 void PixelTexGenParameter{if}SGIS(enum pname, T param); 116 void GetPixelTexGenParameter{if}vSGIS(enum pname, T params); 117 118New Tokens 119 120 Accepted by the <cap> parameter of Enable, Disable, and IsEnabled, and 121 by the <pname> parameter of GetBooleanv, GetIntegerv, GetFloatv, and 122 GetDoublev: 123 124 PIXEL_TEXTURE_SGIS = 0x8353 125 126 Accepted by the <pname> parameter of PixelTexGenParameteriSGIS 127 and GetPixelTexGenParameterivSGIS: 128 129 PIXEL_FRAGMENT_RGB_SOURCE_SGIS = 0x8354 130 PIXEL_FRAGMENT_ALPHA_SOURCE_SGIS = 0x8355 131 132 Accepted by the <param> parameter of PixelTexGenParameteriSGIS: 133 134 PIXEL_GROUP_COLOR_SGIS = 0x8356 135 136Additions to Chapter 2 of the 1.0 Specification (OpenGL Operation) 137 138 None 139 140Additions to Chapter 3 of the 1.0 Specification (Rasterization) 141 142 This extension modifies the "Conversion to Fragments" subsection of 143 section 3.6.3 (Rasterization of Pixel Rectangles) of the GL 144 Specification. The paragraph beginning with "A fragment 145 arising from a group..." ends with "color and texture coordinates 146 are given by those associated with the current raster position." 147 The rest of the paragraph, beginning with "In both cases texture 148 coordinates..." is replaced with the following: 149 150 In all cases texture coordinates s, t, and r are replaced with 151 s/q, t/q, and r/q, respectively. If q is less than or equal to 152 zero, the results are undefined. Groups arising from DrawPixels 153 with a format of STENCIL_INDEX are treated specially and 154 are described in section 4.3.1. 155 156 The treatment of fragments arising from groups consisting of RGBA color 157 data is affected by PIXEL_TEXTURE_SGIS, which is enabled and disabled by 158 calling Enable and Disable with PIXEL_TEXTURE_SGIS passed as the <cap> 159 parameter. 160 161 When PIXEL_TEXTURE_SGIS is enabled, a fragment arising from 162 a group consisting of RGBA color data takes its depth component 163 from the current raster position depth, and the texture coordinates 164 are assigned as follows: 165 166 Pixel group's red becomes the fragment S texture coordinate 167 Pixel group's green becomes the fragment T texture coordinate 168 Pixel group's blue becomes the fragment R texture coordinate 169 Pixel group's alpha becomes the fragment Q texture coordinate 170 171 The default operation is to set the texture coordinate value to 172 the color component value with no conversion. 173 174 Various parameters control how the fragment is derived from 175 the pixel group when PIXEL_TEXTURE_SGIS is enabled. 176 Each parameter is set by calling 177 178 PixelTexGenParameter{if}(enum pname, T param) ; 179 PixelTexGenParameter{if}v(enum pname, T params) ; 180 181 The parameter pname is a symbolic constant indicating the parameter to be 182 set. In the first form of the command, params is value to which 183 to set a single-valued parameter; in the second form of the 184 command, params is an array of parameters whose type depends 185 on the parameter being set. 186 187 If pname is PIXEL_FRAGMENT_RGB_SOURCE_SGIS or 188 PIXEL_FRAGMENT_ALPHA_SOURCE_SGIS, param is an integer 189 that is one of the symbolic constants CURRENT_RASTER_COLOR or 190 PIXEL_GROUP_COLOR_SGIS. 191 192 The assignment of the fragment color components when PIXEL_TEXTURE_SGIS 193 is enabled is determined by the values of PIXEL_FRAGMENT_RGB_SOURCE_SGIS 194 and PIXEL_FRAGMENT_ALPHA_SOURCE_SGIS as defined by the following tables: 195 196 PIXEL_FRAGMENT_RGB_SOURCE_SGIS Resulting fragment RGB 197 ------------------------------ ---------------------- 198 CURRENT_RASTER_COLOR CRP's RGB 199 PIXEL_GROUP_COLOR_SGIS PG's RGB 200 201 PIXEL_FRAGMENT_ALPHA_SOURCE_SGIS Resulting fragment A 202 -------------------------------- -------------------- 203 CURRENT_RASTER_COLOR CRP's A 204 PIXEL_GROUP_COLOR_SGIS PG's A 205 206 PG, CRP, R, G, B, A are abbreviations of "current raster 207 position", "pixel group", "red", "green", "blue", and "alpha" 208 respectively. 209 210 When the pixel_texture extension is enabled, the lambda 211 value used in the texture mapping equations is set to zero. 212 213Additions to Chapter 4 of the 1.0 Specification (Per-Fragment Operations 214and the Frame Buffer) 215 216 The operation of PIXEL_TEXTURE_SGIS during pixel copy operations is 217 identical to the operation during pixel drawing. 218 219Additions to Chapter 5 of the 1.0 Specification (Special Functions) 220 221 The following commands are not included in display lists: 222 223 GetPixelTexGenParameter{if}vSGIS 224 225Additions to Chapter 6 of the 1.0 Specification (State and State Requests) 226 227 Add to the list of Get commands following the paragraph starting 228 with "Other commands exist to obtain state variables that are 229 indexed by a target...": 230 231 GetPixelTexGenParameter{if}vSGIS( enum value, T data ); 232 233 Change the phrase a few paragraph later "GetMaterial, GetTexGen, 234 GetTexEnv, and GetTexParameter are similar to GetLight, 235 placing information..." to "GetMaterial, GetTexGen, GetTexEnv, 236 GetTexParameter, and GetPixelTexGenParameter{if}vSGIS 237 are similar to GetLight, placing information..." 238 239Additions to the GLX Specification 240 241 None 242 243Errors 244 245 INVALID_ENUM is generated if PixelTexGenParameterSGIS parameter <pname> 246 is not PIXEL_FRAGMENT_RGB_SOURCE_SGIS or PIXEL_FRAGMENT_ALPHA_SOURCE_SGIS. 247 248 INVALID_ENUM is generated if PixelTexGenParameterSGIS parameter <pname> 249 is one of PIXEL_FRAGMENT_RGB_SOURCE_SGIS or 250 PIXEL_FRAGMENT_ALPHA_SOURCE_SGIS and parameter <param> is not 251 CURRENT_RASTER_COLOR or PIXEL_GROUP_COLOR_SGIS. 252 253 INVALID_OPERATION is generated if PixelTexGenParameteriSGIS, 254 PixelTexGenParameterivSGIS, or GetPixelTexGenParameterivSGIS 255 are called between the execution of Begin and the execution 256 of the corresponding End. 257 258New State 259 260 The following is added to Table 6.16. Pixels. 261 262 Get Value Get Command Type Initial Value Attrib 263 --------- ----------- ---- ------------- ------ 264 PIXEL_TEXTURE_SGIS IsEnabled B FALSE pixel/enable 265 PIXEL_FRAGMENT_RGB_SOURCE_SGIS GetPixelTexGenParameterivSGIS Z2 PIXEL_GROUP_COLOR_SGIS pixel 266 PIXEL_FRAGMENT_ALPHA_SOURCE_SGIS GetPixelTexGenParameterivSGIS Z2 PIXEL_GROUP_COLOR_SGIS pixel 267 268New Implementation Dependent State 269 270 None 271