1Name 2 3 NV_texgen_reflection 4 5Name Strings 6 7 GL_NV_texgen_reflection 8 9Contact 10 11 Mark J. Kilgard, NVIDIA Corporation (mjk 'at' nvidia.com) 12 13Notice 14 15 Copyright NVIDIA Corporation, 1999. 16 17Status 18 19 Shipping (version 1.0) 20 NVIDIA, Mesa 3.1, and ATI support this. 21 22 This extension's texture coordinate generation functionality is 23 incoporated into the ARB_texture_cube_map extension. The same 24 enumerant values are used. 25 26 The ARB_texture_cube_map functionality, including this texgen 27 reflection functionality, is part of OpenGL 1.3 and subsequent 28 revisions of the core OpenGL standard. 29 30Version 31 32 June 17, 2003 (version 1.0) 33 34Number 35 36 179 37 38Dependencies 39 40 Written based on the wording of the OpenGL 1.2 specification but 41 not dependent on it. 42 43Overview 44 45 This extension provides two new texture coordinate generation modes 46 that are useful texture-based lighting and environment mapping. 47 The reflection map mode generates texture coordinates (s,t,r) 48 matching the vertex's eye-space reflection vector. The reflection 49 map mode is useful for environment mapping without the singularity 50 inherent in sphere mapping. The normal map mode generates texture 51 coordinates (s,t,r) matching the vertex's transformed eye-space 52 normal. The normal map mode is useful for sophisticated cube map 53 texturing-based diffuse lighting models. 54 55Issues 56 57 Should we place the normal/reflection vector in the (s,t,r) texture 58 coordinates or (s,t,q) coordinates? 59 60 RESOLUTION: (s,t,r). Even if the proposed hardware uses "q" for 61 the third component, the API should claim to support generation of 62 (s,t,r) and let the texture matrix (through a concatenation with 63 the user-supplied texture matrix) move "r" into "q". 64 65 Should you be able to have some texture coordinates computing 66 REFLECTION_MAP_NV and others not? Same question with NORMAL_MAP_NV. 67 68 RESOLUTION: YES. This is the way that SPHERE_MAP works. It is 69 not clear that this would ever be useful though. 70 71 Should something special be said about the handling of the q 72 texture coordinate for this spec? 73 74 RESOLUTION: NO. But the following paragraph is useful for 75 implementors concerned about the handling of q. 76 77 The REFLECTION_MAP_NV and NORMAL_MAP_NV modes are intended to supply 78 reflection and normal vectors for cube map texturing hardware. 79 When these modes are used for cube map texturing, the generated 80 texture coordinates can be thought of as a reflection vector. 81 The value of the q texture coordinate then simply scales the 82 vector but does not change its direction. Because only the vector 83 direction (not the vector magnitude) matters for cube map texturing, 84 implementations are free to leave q undefined when any of the s, 85 t, or r texture coordinates are generated using REFLECTION_MAP_NV 86 or NORMAL_MAP_NV. 87 88New Procedures and Functions 89 90 None 91 92New Tokens 93 94 Accepted by the <param> parameters of TexGend, TexGenf, and TexGeni 95 when <pname> parameter is TEXTURE_GEN_MODE: 96 97 NORMAL_MAP_NV 0x8511 98 REFLECTION_MAP_NV 0x8512 99 100 When the <pname> parameter of TexGendv, TexGenfv, and TexGeniv is 101 TEXTURE_GEN_MODE, then the array <params> may also contain 102 NORMAL_MAP_NV or REFLECTION_MAP_NV. 103 104Additions to Chapter 2 of the 1.2 Specification (OpenGL Operation) 105 106 -- Section 2.10.4 "Generating Texture Coordinates" 107 108 Change the last sentence in the 1st paragraph to: 109 110 "If <pname> is TEXTURE_GEN_MODE, then either <params> points to 111 or <param> is an integer that is one of the symbolic constants 112 OBJECT_LINEAR, EYE_LINEAR, SPHERE_MAP, REFLECTION_MAP_NV, or 113 NORMAL_MAP_NV." 114 115 Add these paragraphs after the 4th paragraph: 116 117 "If TEXTURE_GEN_MODE indicates REFLECTION_MAP_NV, compute the 118 reflection vector r as described for the SPHERE_MAP mode. Then the 119 value assigned to an s coordinate (the first TexGen argument value 120 is S) is s = rx; the value assigned to a t coordinate is t = ry; 121 and the value assigned to a r coordinate is r = rz. Calling TexGen 122 with a <coord> of Q when <pname> indicates REFLECTION_MAP_NV 123 generates the error INVALID_ENUM. 124 125 If TEXTURE_GEN_MODE indicates NORMAL_MAP_NV, compute the normal 126 vector n' as described in section 2.10.3. Then the value assigned 127 to an s coordinate (the first TexGen argument value is S) is s = 128 nfx; the value assigned to a t coordinate is t = nfy; and the 129 value assigned to a r coordinate is r = nfz. (The values nfx, nfy, 130 and nfz are the components of nf.) Calling TexGen with a <coord> 131 of Q when <pname> indicates REFLECTION_MAP_NV generates the error 132 INVALID_ENUM. 133 134 The last paragraph's first sentence should be changed to: 135 136 "The state required for texture coordinate generation comprises a 137 five-valued integer for each coordinate indicating coordinate 138 generation mode, ..." 139 140Additions to Chapter 3 of the 1.2 Specification (Rasterization) 141 142 None 143 144Additions to Chapter 4 of the 1.2 Specification (Per-Fragment Operations 145and the Frame Buffer) 146 147 None 148 149Additions to Chapter 5 of the 1.2 Specification (Special Functions) 150 151 None 152 153Additions to Chapter 6 of the 1.2 Specification (State and State Requests) 154 155 None 156 157Additions to the GLX Specification 158 159 None 160 161Errors 162 163 INVALID_ENUM is generated when TexGen is called with a <coord> of Q 164 when <pname> indicates REFLECTION_MAP_NV or NORMAL_MAP_NV. 165 166New State 167 168(table 6.14, p204) change the entry for TEXTURE_GEN_MODE to: 169 170 Get Value Type Get Command Initial Value Description Sec Attribute 171 --------- ---- ----------- ------------- ----------- ------ --------- 172 TEXTURE_GEN_MODE 4xZ5 GetTexGeniv EYE_LINEAR Function used for 2.10.4 texture 173 texgen (for s,t,r, 174 and q) 175 176(the type changes from 4xZ3 to 4xZ5) 177 178New Implementation State 179 180 None 181 182Revision History 183 184 None 185