1Name 2 3 WIN_phong_shading 4 5Name Strings 6 7 GL_WIN_phong_shading 8 9Version 10 11 $Date: 1997/4/3 12 13Number 14 15 113 16 17Dependencies 18 19 None 20 21Overview 22 23 WIN_phong_shading enables rendering Phong shaded primitives using OpenGL. 24 Phong shading is a well known shading technique documented 25 in most graphics texts. 26 27 As opposed to Gouraud (or smooth) shading, which simply calculates the 28 normals at the vertices and then interpolates the colors of the pixels, 29 Phong shading involves interpolating an individual normal for every pixel, 30 and then applying the shading model to each pixel based on its normal 31 component. 32 33 While Phong shading requires substantially more computation than does 34 Gouraud shading, the resulting images are more realistic, especially if the 35 primitives are large. 36 37Issues 38 39 None 40 41New Procedures and Functions 42 43 None 44 45New Tokens 46 47 Accepted by the <mode> parameter of ShadeModel: 48 49 PHONG_WIN 0x80EA 50 51 May be returned by GetBooleanv, GetDoublev, GetIntegerv, and GetFloatv 52 when their <pname> parameter is SHADE_MODEL: 53 54 PHONG_WIN 0x80EA 55 56 Accepted by the <target> parameter of Hint, and <pname> parameter of 57 GetBooleanv, GetDoublev, GetFloatv and GetIntegerv: 58 59 PHONG_HINT_WIN 0x80EB 60 61Additions to Chapter 2 of the 1.1 Specification (OpenGL Operation) 62 First sentence in Section 2.13, "Colors and Coloring", 'Figure 2.8 63 diagrams..' should be modified as below: 64 65 "Figure 2.8 diagrams the processing of colors before rasterization when 66 the primitives are not phong-shaded." 67 68 After the last paragraph of Section 2.13, "Colors and Coloring", the 69 70 following paragraph is added: 71 72 "The WIN_phong_shading extension is used to indicate that the primitives 73 should be phong shaded. In which case, the lighting, if enabled, is 74 applied at the time of rasterization to each pixel to obtain a color for 75 that pixel. The lighting computation used is consistant with the GL 76 lighting model described in Section 2.13.1. If the primitive is clipped, 77 then normals (and eye coordinates) must be computed for the vertices 78 introduced or modified by clipping." 79 80 Rename Section 2.13.7 to "Shading Models" and. Keep the first paragraph as 81 it is. Add the following new paragraph after the one ending in 82 "...Table 2.9 summarizes the possibilities": 83 84 "A primitive may be phong-shaded, meaning that instead of the the color 85 being interpolated, the normal (and the eye coordinate) are interpolated 86 across the primitive, and the lighting (if enabled) is applied per pixel 87 at the time of rasterization. If the other material properties change 88 within a primitive, either by ColorMaterial or explicitly changing the 89 material property using the Material command, they must be also be 90 interpolated along with the normal (and eye coordinate). However, for 91 efficiency's sake, an implementation may choose to ignore the effects of 92 the changes in material properties across a primitive. 93 If the lighting is disabled, or if the primitive is a point, it is 94 equivalent to regular smooth shading. 95 96 Implementations may also choose to approximate phong-shading by smart 97 interpolation techniques (some of which are described in graphics 98 literature). Using such algorithms, they may choose to tradeoff visual 99 fidelity for speed of rendering. For such a case a phong hint state, 100 discussed in section 5.6, can be used." 101 102 Modify the paragraph beginning with "Flatshading is controlled by....." 103 to the following: 104 105 "Phong-shading and flatshading are controlled by 106 107 void ShadeModel( enum mode); 108 109 mode value must be one of the symbolic constant SMOOTH, FLAT or 110 PHONG_WIN. If mode is SMOOTH (the initial state), vertex colors are 111 treated individually. If mode is FLAT, flatshading is turned on. If mode 112 is PHONG_WIN phong-shading is turned on. ShadeModel thus requires 2 bits 113 of state." 114 115 Rename Section 2.13.8 to "Color, Texture, Normal and Eye-Coordinate 116 Clipping". Add the following line after "The method is exactly...": 117 118 "If phong-shading is turned on, the normals and eye coordinates must be 119 computed for the newly generated vertices. The normals and the 120 eye-coordinates for these vertices are computed in exactly the manner 121 described for color clipping. In addition, unless the implementation 122 chooses to ignore changes in material properties within the primitive, 123 they should be computed for the new vertices analogously." 124 125 126Additions to Chapter 3 of the 1.1 Specification (Rasterization) 127 128 After the sentence "The second ...." in the first paragraph, add the 129 sentence: 130 131 "If phong-shading is enabled, the color for the square is also computed 132 in this stage." 133 134 Modify the first line of the second paragraph to: 135 "A grid square along with its parameters of assigned color, z (depth), 136 texture coordinates, normal and eye coordinates (for phong shading)" 137 138 In Section 3.4.1 "Basic Line Segment Rasterization", modify the line 139 140 "The value of an associated datum f......." after equation 3.1 to: 141 142 "The value of an associated datum f for the fragment, whether it be R, G, 143 B, or A (in RGBA mode) or a color index (in color index mode), or normal, 144 eye coordinate or material properties (when phong-shaded), or the s, t, or 145 r texture coordinate .......... is found as" 146 147Additions to Chapter 4 of the 1.1 Specification (Per-Fragment Operations 148and the Frame Buffer) 149 150 None 151 152Additions to Chapter 5 of the 1.1 Specification (Special Functions) 153 154 In Section 5.6, "Hints", add the following phrase to the line beginning 155 "target may be one of .......": 156 157 "and PHONG_HINT_WIN, indicating the desired quality of phong shading." 158 159 160Additions to Chapter 6 of the 1.0 Specification (State and State Requests) 161 162 None 163 164Dependencies on other extensions 165 166 None 167 168Errors 169 170 None 171 172New State 173 Initial 174 Get Value Get Command Type Value Attrib 175 --------- ----------- ---- ------- ------ 176 PHONG_HINT_WIN GetIntegerv Z3 DONT_CARE hint 177 178New Implementation Dependent State 179 180 None 181