1Name 2 3 EXT_pixel_transform 4 5Name Strings 6 7 GL_EXT_pixel_transform 8 9Version 10 11 $Date: 1997/10/17 02:08:51 $ $Revision: 1.2 $ 12 13Number 14 15 138 16 17Dependencies 18 19 None 20 21Overview 22 23 This extension provides support for scaling, rotation, translation and 24 shearing of two-dimensional pixel rectangles in the pixel rasterizer. 25 The transformation is defined via a 4x4 matrix, where only those entries 26 which apply as a 2D affine transformation will be accepted and used. 27 These matrices can be manipulated using the same functions as the other 28 OpenGL matrix stacks. 29 30 31New Procedures and Functions 32 33 void PixelTransformParameteriEXT(enum target, 34 enum pname, 35 const int param) 36 37 void PixelTransformParameterfEXT(enum target, 38 enum pname, 39 const float param) 40 41 void PixelTransformParameterivEXT(enum target, 42 enum pname, 43 const int* params) 44 45 void PixelTransformParameterfvEXT(enum target, 46 enum pname, 47 const float* params) 48 49 These routines are used to set pixel transformation attributes. 50 The only allowable value for <target> at this time is 51 PIXEL_TRANSFORM_2D_EXT. Allowable values for <pname> include: 52 PIXEL_MAG_FILTER_EXT, PIXEL_MIN_FILTER_EXT, and PIXEL_CUBIC_WEIGHT_EXT. 53 54 void GetPixelTransformParameterivEXT(enum target, 55 enum pname, 56 const int* params) 57 58 void GetPixelTransformParameterfvEXT(enum target, 59 enum pname, 60 const float* params) 61 62 These routines are used to query pixel transformation attributes. 63 The only allowable value for <target> at this time is 64 PIXEL_TRANSFORM_2D_EXT. Allowable values for <pname> include: 65 PIXEL_MAG_FILTER_EXT, PIXEL_MIN_FILTER_EXT, and PIXEL_CUBIC_WEIGHT_EXT. 66 67New Tokens 68 69 Accepted by the <pname> parameter of PixelTransformParameteri, 70 PixelTransformParameterf, PixelTransformParameteriv, 71 PixelTransformParameterfv, GetPixelTransformParameteriv and 72 GetPixelTransformParameterfv: 73 74 PIXEL_MAG_FILTER_EXT 0x8331 75 PIXEL_MIN_FILTER_EXT 0x8332 76 PIXEL_CUBIC_WEIGHT_EXT 0x8333 77 78 Accepted by the <params> parameter of PixelTransformParameteriEXT, 79 PixelTransformParameterfEXT, PixelTransformParameterivEXT, and 80 PixelTransformParameterfvEXT when <pname> is PIXEL_MAG_FILTER_EXT 81 or PIXEL_MIN_FILTER_EXT: 82 83 CUBIC_EXT 0x8334 84 85 Accepted by the <params> parameter of PixelTransformParameteriEXT, 86 PixelTransformParameterfEXT, PixelTransformParameterivEXT, and 87 PixelTransformParameterfvEXT when <pname> is PIXEL_MIN_FILTER_EXT: 88 89 AVERAGE_EXT 0x8335 90 91 Accepted by the <mode> parameter of MatrixMode, 92 and by the <target> parameter of PixelTransformParameterivEXT, 93 PixelTransformParameterfvEXT, GetPixelTransformParameterivEXT, 94 and GetPixelTransformParameterfvEXT: 95 96 PIXEL_TRANSFORM_2D_EXT 0x8330 97 98 Accepted by the <pname> parameter of GetIntegerv, GetFloatv, 99 and GetDoublev: 100 101 PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT 0x8336 102 MAX_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT 0x8337 103 104 Accepted by the <pname> parameter of GetFloatv, and GetDoublev: 105 106 PIXEL_TRANSFORM_2D_MATRIX_EXT 0x8338 107 108 109Additions to Chapter 2 of the 1.1 Specification (OpenGL Operation) 110 111 In section 2.10.2 "Matrices": 112 113 The projection matrix, model-view matrix and pixel-transform matrix 114 are set and modified with a variety of commands. The affected matrix is 115 determined by the current matrix mode. The current matrix mode is set with 116 117 void MatrixMode (enum mode); 118 119 which takes one of the four pre-defined constants TEXTURE, MODELVIEW, 120 PROJECTION, or PIXEL_TRANSFORM_2D_EXT as the argument value. TEXTURE is 121 described later. If the current matrix mode is MODELVIEW, then matrix 122 operations apply to the model-view matrix; if PROJECTION, then they apply 123 to the projection matrix; if PIXEL_TRANSFORM_2D_EXT, then they apply to 124 the pixel-transform matrix. 125 126Additions to Chapter 3 of the 1.1 Specification (Rasterization) 127 128 The specification of two-dimensional pixel transformation operators 129 is defined in the GL specification in the final subsection of 130 Section 3.6.3, "Conversion to Fragments." The following paragraphs 131 replace the text of the subsection. 132 133 The conversion of a group to fragments is controlled by the pixel 134 transformation matrix. The pixel transformation matrix is defined 135 by calling MatrixMode with <mode> set to PIXEL_TRANSFORM_2D_EXT, then using 136 any of the existing functions which operate on matrices and matrix stacks. 137 (i.e. LoadIdentity, LoadMatrix, MultMatrix, PushMatrix, PopMatrix, Rotate, 138 Scale, and Translate.) When using the matrix operators, while in 139 PIXEL_TRANSFORM_2D_EXT matrix mode, those entries in the 4 x 4 matrix 140 that are not part of a 2D affine transformation are forced to take on 141 values of either 0 or 1 so that the final matrix represents a 2D affine 142 transformation matrix. That is to say, of the matrix entries shown below: 143 144 -- -- 145 | m0 m4 m8 m12| 146 P = | m1 m5 m9 m13| 147 | m2 m6 m10 m14| 148 | m3 m7 m11 m15| 149 -- -- 150 151 only the matrix entries m0, m1, m4, m5, m12, and m13 are allowed to 152 vary. The other matrix entries will be forced to be either 0 or 1 as 153 shown below: 154 155 -- -- 156 | m0 m4 0 m12| 157 P = | m1 m5 0 m13| 158 | 0 0 1 0 | 159 | 0 0 0 1 | 160 -- -- 161 162 The pixel transformation operation is always enabled. The pixel 163 transformation operation uses the current pixel transformation 164 matrix to compute new window coordinates for each incoming pixel. 165 Resampling occurs after the pixel transformation matrix has been 166 applied. 167 168 Window coordinates are computed for each group by multiplying 169 the column/row location in the original pixel rectangle by the pixel 170 transformation matrix. The components of the current raster position 171 (section 2.12) are then added to the resulting components. (If the 172 current raster position is invalid, then DrawPixels is 173 ignored.) Let (Xrp, Yrp) be the current raster position and let 174 (Xo, Yo) represent the column and row of the group in the original 175 pixel rectangle. The depth value (Z) for the group is defined 176 as the depth value at the original location in the pixel rectangle 177 if the format was DEPTH_COMPONENT, and as the depth associated with 178 the current raster position otherwise. The final transformed pixel 179 coordinate (Xf, Yf, Zf) is computed by: 180 181 -- -- -- -- 182 | Xo | | Xt | 183 | Yo | P = | Yt | 184 | Z | | Zt | 185 | 1 | | 1 | 186 -- -- -- -- 187 188 Xf = Xt + Xrp 189 Yf = Yt + Yrp 190 Zf = Zt 191 192 The function 193 194 void PixelZoom( float zx, float zy ) ; 195 196 will set the current pixel transformation matrix (the current top 197 of the pixel transformation matrix stack) to the scaling matrix: 198 199 -- -- 200 | zx 0 0 0 | 201 P = | 0 zy 0 0 | 202 | 0 0 1 0 | 203 | 0 0 0 1 | 204 -- -- 205 206 The original pixel value for each input pixel location is left unmodified 207 by the pixel transformation. Since multiple input pixels can be mapped 208 into a single output pixel (minification of the input pixel rectangle), 209 or since output pixels might not have any input pixels mapped to them 210 (magnification of input pixel rectangle), some method of resampling 211 is required. Resampling methods are set using the functions 212 PixelTransformParameteriEXT, PixelTransformParameterfEXT, 213 PixelTransformParameterivEXT, or PixelTransformParameterfvEXT with 214 <target> set to PIXEL_TRANSFORM_2D_EXT. 215 216 The resampling method to be used when the pixel rectangle is 217 magnified is specified by calling one of these functions with 218 <pname> set to PIXEL_MAG_FILTER_EXT and <params> set to NEAREST, 219 LINEAR, or CUBIC_EXT. The resampling method to be used when the 220 pixel rectangle is minified is specified by calling one of these 221 functions with <pname> set to PIXEL_MIN_FILTER_EXT and <params> 222 set to NEAREST, LINEAR, CUBIC_EXT, or AVERAGE_EXT. 223 PIXEL_CUBIC_WEIGHT_EXT defines the cubic weighting coefficient 224 that is to be used whenever the resampling technique is set to CUBIC_EXT. 225 226 If the resampling method is NEAREST, each output pixel will have the 227 value of the input pixel whose transformed coordinate value is nearest 228 (in Manhattan distance). If the resampling method is LINEAR, each 229 output pixel will have a value that is the weighted average of the 230 four input pixels whose transformed coordinate values are nearest. 231 232 If the resampling method is CUBIC_EXT, each output pixel will have a value 233 that is affected by the 16 input pixels whose transformed coordinate 234 values are nearest. The 16 input pixels will be used to perform a cubic 235 spline interpolation to determine the value of the output pixel. The 236 cubic weight factor is a floating point value that is applied to the 237 cubic interpolation in the manner described in "Digital Image Warping" 238 by George Wolberg (IEEE Computer Society Press, ISBN 0-8186-8944-7). 239 Visually pleasing cubic weighting values are typically in the 240 range [-1,0]. The values -1.0 and -0.5 are most commonly used. 241 For the purpose of performing bicubic interpolation along the outer 242 edge of the pixel rectangle, the outermost one pixel edge of the pixel 243 rectangle is duplicated prior to performing the interpolation along the 244 edges. 245 246 If the resampling method is AVERAGE_EXT, the values of all of the input 247 pixels that contribute to the final output pixel will be averaged to 248 determine the final output pixel value. That is to say, an output pixel 249 is backward mapped into the input pixel rectangle, then the nearest 250 neighbor resampling method determines the address of the center input 251 pixel from which input pixels will be averaged. All pixels in the input 252 that forward map into the same location in the output pixel rectangle will 253 be added together and divided by the total number of input pixels which 254 contribute the same output pixel. An example would be, if the output 255 pixel rectangle is 1/3 the size of the input pixel rectangle, then a 256 total of 9 pixels would be read from the input pixel rectangle, averaged, 257 and then the new single value will be written into the output pixel 258 rectangle. 259 260 Pixel transformation is defined for pixel rectangles that contain INDEX, 261 LUMINANCE, LUMINANCE_ALPHA, RGB, RGBA, or ABGR_EXT components or depth 262 components in pixel rastorization. Groups arising from DrawPixels with 263 a format of STENCIL_INDEX are treated specially and are described in 264 section 4.3.1. 265 266 A fragment arising from a group consisting of color data takes on the 267 color index or color components of the group; the depth and texture 268 coordinates are taken from the current raster position's associated 269 data. A fragment arising from a depth component takes the component's 270 depth value; the color and texture coordinates are given by those 271 associated with the current raster position. In both cases texture 272 coordinates s, t, and r are replaced with s/q, t/q, and r/q, 273 respectively. 274 275 276Additions to Chapter 4 of the 1.1 Specification (Per-Fragment Operations 277and the Frame Buffer) 278 279 The pixel transformation operation occurs in pixel rasterization 280 immediately after the operations in the pixel transfer pipeline. 281 The operation of pixel transformation during pixel copy 282 operations is identical to the operation during pixel drawing. 283 The pixel transformation is not applied during pixel query 284 operations. 285 286Additions to Chapter 5 of the 1.1 Specification (Special Functions) 287 288 GetPixelTransformParameterivEXT, and GetPixelTransformParameterfvEXT 289 are not included in display lists, but are instead executed immediately. 290 291Additions to Chapter 6 of the 1.1 Specification (State and State Requests) 292 293 Integer and floating point query functions GetPixelTransformParameterivEXT 294 and GetPixelTransformParameterfvEXT are provided. <target> must be 295 PIXEL_TRANSFORM_2D_EXT. <pname> is one of PIXEL_MAG_FILTER_EXT, 296 PIXEL_MIN_FILTER_EXT, or PIXEL_CUBIC_WEIGHT_EXT. The value of the 297 specified parameter is returned in <params>. 298 299Additions to the GLX Specification 300 301 None 302 303GLX Protocol 304 305 Four new GL commands are added. 306 307 The following two rendering commands are sent to the server as part of 308 a glXRender request: 309 310 PixelTransformParameterfEXT 311 2 16 rendering command length 312 2 16385 rendering command opcode 313 4 ENUM target 314 4 ENUM pname 315 4 FLOAT32 param 316 317 PixelTransformParameteriEXT 318 2 16 rendering command length 319 2 16386 rendering command opcode 320 4 ENUM target 321 4 ENUM pname 322 4 INT32 param 323 324 The remaining two commands are non-rendering commands. These commands 325 are sent seperately (i.e., not as part of a glXRender or 326 glXRenderLarge request), using the glXVendorPrivateWithReply 327 request: 328 329 GetPixelTransformParameterfvEXT 330 1 CARD8 opcode (X assigned) 331 1 17 GLX opcode (glXVendorPrivateWithReply) 332 2 5 request length 333 4 2051 vendor specific opcode 334 4 GLX_CONTEXT_TAG context tabg 335 4 ENUM target 336 4 ENUM pname 337 ==> 338 1 1 reply 339 1 unused 340 2 CARD16 sequence number 341 4 m reply length, m = (n==1 ? 0: n) 342 4 unused 343 4 CARD16 n (0 or 1) 344 345 if (n=1) this follows: 346 347 4 FLOAT32 params 348 12 unused 349 350 Note that n may be zero, indicating that a GL error occurred. 351 352 353 GetPixelTransformParameterivEXT 354 1 CARD8 opcode (X assigned) 355 1 17 GLX opcode (glXVendorPrivateWithReply) 356 2 5 request length 357 4 2052 vendor specific opcode 358 4 GLX_CONTEXT_TAG context tabg 359 4 ENUM target 360 4 ENUM pname 361 ==> 362 1 1 reply 363 1 unused 364 2 CARD16 sequence number 365 4 m reply length, m = (n==1 ? 0: n) 366 4 unused 367 4 CARD16 n (0 or 1) 368 369 if (n=1) this follows: 370 371 4 INT32 params 372 12 unused 373 374 Note that n may be zero, indicating that a GL error occurred. 375 376 377 378Errors 379 380 INVALID_ENUM is generated if PixelTransformParameteriEXT, 381 PixelTransformParameterfEXT, PixelTransformParameterivEXT, 382 PixelTransformParameterfvEXT, GetPixelTransformParameterivEXT, 383 or GetPixelTransformParameterfvEXT is called with <target> set to 384 a value other than PIXEL_TRANSFORM_2D_EXT. 385 386 INVALID_ENUM is generated if GetPixelTransformParameterivEXT or 387 GetPixelTransformParameterfvEXT is called with <pname> set to 388 PIXEL_MAG_FILTER_EXT and <params> is not one of NEAREST, LINEAR, 389 or CUBIC_EXT. 390 391 INVALID_ENUM is generated if GetPixelTransformParameterivEXT or 392 GetPixelTransformParameterfvEXT is called with <pname> set to 393 PIXEL_MIN_FILTER_EXT and <params> is not one of NEAREST, LINEAR, 394 CUBIC_EXT, or AVERAGE_EXT. 395 396 INVALID_VALUE is generated if PixelTransformParameteriEXT, 397 PixelTransformParameterfEXT, PixelTransformParameterivEXT, or 398 PixelTransformParameterfvEXT is called with <pname> set to 399 PIXEL_CUBIC_WEIGHT_EXT and <params> is a value outside of 400 the range [-1, 0]. 401 402 INVALID_OPERATION is generated if PixelTransformParameteriEXT, 403 PixelTransformParameterfEXT, PixelTransformParameterivEXT, 404 PixelTransformParameterfvEXT, GetPixelTransformParameterivEXT, 405 or GetPixelTransformParameterfvEXT is called between execution of 406 Begin and the corresponding execution of End. 407 408New State 409 Initial 410 Get Value Get Command Type Value Attrib 411 --------- ----------- ---- ------- ------ 412 PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT GetIntegerv I 1 - 413 PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT GetFloatv R 1 - 414 PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT GetDoublev D 1 - 415 MAX_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT GetIntegerv I 32 - 416 MAX_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT GetFloatv R 32 - 417 MAX_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT GetDoublev D 32 - 418 PIXEL_TRANSFORM_2D_MATRIX_EXT GetFloatv 16 x R Identity - 419 PIXEL_TRANSFORM_2D_MATRIX_EXT GetDoublev 16 x D Identity - 420 PIXEL_MAG_FILTER_EXT GetPixelTransformParameteri Z3 NEAREST pixel 421 PIXEL_MIN_FILTER_EXT GetPixelTransformParameteri Z4 NEAREST pixel 422 PIXEL_CUBIC_WEIGHT_EXT GetPixelTransformParameterf R -1 pixel 423 424 425New Implementation Dependent State 426 427 None 428 429