build1dmipmaps.3gl 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  1. '\" e
  2. '\"! eqn | mmdoc
  3. '\"macro stdmacro
  4. .ds Vn Version 1.2
  5. .ds Dt 6 March 1997
  6. .ds Re Release 1.2.0
  7. .ds Dp May 02 11:53
  8. .ds Dm 37 build1dmi
  9. .ds Xs 40806 9 build1dmipmaps.gl
  10. .TH GLUBUILD1DMIPMAPS 3G
  11. .SH NAME
  12. .B "gluBuild1DMipmaps
  13. \- builds a one-dimensional mipmap
  14. .SH C SPECIFICATION
  15. GLint \f3gluBuild1DMipmaps\fP(
  16. GLenum \fItarget\fP,
  17. .nf
  18. .ta \w'\f3GLint \fPgluBuild1DMipmaps( 'u
  19. GLint \fIinternalFormat\fP,
  20. GLsizei \fIwidth\fP,
  21. GLenum \fIformat\fP,
  22. GLenum \fItype\fP,
  23. const void \fI*data\fP )
  24. .fi
  25. .EQ
  26. delim $$
  27. .EN
  28. .SH PARAMETERS
  29. .TP \w'\fIinternalFormat\fP\ \ 'u
  30. \f2target\fP
  31. Specifies the target texture. Must be \%\f3GL_TEXTURE_1D\fP.
  32. .TP
  33. \f2internalFormat\fP
  34. Requests the internal storage of the texture image. The most
  35. current version of the SGI implementation of GLU does not check this
  36. value for validity before passing it on to the underlying OpenGL
  37. implementation. A value that is not accepted by the OpenGL
  38. implementation will lead to an OpenGL error. The benefit of not
  39. checking this value at the GLU level is that OpenGL extensions can add
  40. new internal texture formats without requiring a revision of the GLU
  41. implementation. Older implementations of GLU check this value and
  42. raise a GLU error if it is not 1, 2, 3, or 4 or one of the following
  43. symbolic constants:
  44. \%\f3GL_ALPHA\fP,
  45. \%\f3GL_ALPHA4\fP,
  46. \%\f3GL_ALPHA8\fP,
  47. \%\f3GL_ALPHA12\fP,
  48. \%\f3GL_ALPHA16\fP,
  49. \%\f3GL_LUMINANCE\fP,
  50. \%\f3GL_LUMINANCE4\fP,
  51. \%\f3GL_LUMINANCE8\fP,
  52. \%\f3GL_LUMINANCE12\fP,
  53. \%\f3GL_LUMINANCE16\fP,
  54. \%\f3GL_LUMINANCE_ALPHA\fP,
  55. \%\f3GL_LUMINANCE4_ALPHA4\fP,
  56. \%\f3GL_LUMINANCE6_ALPHA2\fP,
  57. \%\f3GL_LUMINANCE8_ALPHA8\fP,
  58. \%\f3GL_LUMINANCE12_ALPHA4\fP,
  59. \%\f3GL_LUMINANCE12_ALPHA12\fP,
  60. \%\f3GL_LUMINANCE16_ALPHA16\fP,
  61. \%\f3GL_INTENSITY\fP,
  62. \%\f3GL_INTENSITY4\fP,
  63. \%\f3GL_INTENSITY8\fP,
  64. \%\f3GL_INTENSITY12\fP,
  65. \%\f3GL_INTENSITY16\fP,
  66. \%\f3GL_RGB\fP,
  67. \%\f3GL_R3_G3_B2\fP,
  68. \%\f3GL_RGB4\fP,
  69. \%\f3GL_RGB5\fP,
  70. \%\f3GL_RGB8\fP,
  71. \%\f3GL_RGB10\fP,
  72. \%\f3GL_RGB12\fP,
  73. \%\f3GL_RGB16\fP,
  74. \%\f3GL_RGBA\fP,
  75. \%\f3GL_RGBA2\fP,
  76. \%\f3GL_RGBA4\fP,
  77. \%\f3GL_RGB5_A1\fP,
  78. \%\f3GL_RGBA8\fP,
  79. \%\f3GL_RGB10_A2\fP,
  80. \%\f3GL_RGBA12\fP, or
  81. \%\f3GL_RGBA16\fP.
  82. .TP
  83. \f2width\fP
  84. Specifies the width, in pixels, of the texture image.
  85. .TP
  86. \f2format\fP
  87. Specifies the of the pixel data.
  88. Must be one of
  89. \%\f3GL_COLOR_INDEX\fP,
  90. \%\f3GL_DEPTH_COMPONENT\fP,
  91. \%\f3GL_RED\fP,
  92. \%\f3GL_GREEN\fP,
  93. \%\f3GL_BLUE\fP,
  94. \%\f3GL_ALPHA\fP,
  95. \%\f3GL_RGB\fP,
  96. \%\f3GL_RGBA\fP,
  97. \%\f3GL_BGR\fP,
  98. \%\f3GL_BGRA\fP,
  99. \%\f3GL_LUMINANCE\fP,
  100. \%\f3GL_LUMINANCE_ALPHA\fP.
  101. .TP
  102. \f2type\fP
  103. Specifies the data type for \f2data\fP.
  104. Must be one of
  105. \%\f3GL_UNSIGNED_BYTE\fP,
  106. \%\f3GL_BYTE\fP,
  107. \%\f3GL_BITMAP\fP,
  108. \%\f3GL_UNSIGNED_SHORT\fP,
  109. \%\f3GL_SHORT\fP,
  110. \%\f3GL_UNSIGNED_INT\fP,
  111. \%\f3GL_INT\fP,
  112. \%\f3GL_FLOAT\fP,
  113. \%\f3GL_UNSIGNED_BYTE_3_3_2\fP,
  114. \%\f3GL_UNSIGNED_BYTE_2_3_3_REV\fP,
  115. \%\f3GL_UNSIGNED_SHORT_5_6_5\fP,
  116. \%\f3GL_UNSIGNED_SHORT_5_6_5_REV\fP,
  117. \%\f3GL_UNSIGNED_SHORT_4_4_4_4\fP,
  118. \%\f3GL_UNSIGNED_SHORT_4_4_4_4_REV\fP,
  119. \%\f3GL_UNSIGNED_SHORT_5_5_5_1\fP,
  120. \%\f3GL_UNSIGNED_SHORT_1_5_5_5_REV\fP,
  121. \%\f3GL_UNSIGNED_INT_8_8_8_8\fP,
  122. \%\f3GL_UNSIGNED_INT_8_8_8_8_REV\fP,
  123. \%\f3GL_UNSIGNED_INT_10_10_10_2\fP, or
  124. \%\f3GL_UNSIGNED_INT_2_10_10_10_REV\fP.
  125. .TP
  126. \f2data\fP
  127. Specifies a pointer to the image data in memory.
  128. .SH DESCRIPTION
  129. \%\f3gluBuild1DMipmaps\fP builds a series of prefiltered one-dimensional texture maps of decreasing
  130. resolutions called a mipmap. This is used for the antialiasing of
  131. texture mapped primitives.
  132. .P
  133. A return value of zero indicates success, otherwise a GLU error code is
  134. returned (see \%\f3gluErrorString\fP).
  135. .P
  136. Initially, the \f2width\fP of \f2data\fP is checked to see if it is
  137. a power of 2. If not, a copy of \f2data\fP is scaled up or down to the
  138. nearest power of 2. (If \f2width\fP is exactly between powers of 2, then
  139. the copy of \f2data\fP will scale upwards.) This copy will be used for
  140. subsequent mipmapping operations described below.
  141. For example, if \f2width\fP is 57 then a copy of \f2data\fP
  142. will scale up to 64 before mipmapping
  143. takes place.
  144. .P
  145. Then, proxy textures (see \f3glTexImage1D\fP) are used to determine if
  146. the implementation can fit the requested texture. If not, \f2width\fP is
  147. continually halved until it fits.
  148. .P
  149. Next, a series of mipmap levels is built by decimating a copy of
  150. \f2data\fP in half
  151. until size $1 ~times~ 1$ is reached. At each level, each texel in the
  152. halved mipmap level is an average of the corresponding two texels in the larger
  153. mipmap level.
  154. .P
  155. \f3glTexImage1D\fP is called to load each of these mipmap levels.
  156. Level 0 is a copy of \f2data\fP.
  157. The highest level is ${log sub 2}(\f2width\fP)$.
  158. For example, if \f2width\fP is 64 and the implementation can store a texture of
  159. this size, the following mipmap levels are
  160. built: $64 ~times~ 1$, $32 ~times~ 1$, $16 ~times~ 1$, $8 ~times~ 1$,
  161. $4 ~times~ 1$, $2 ~times~ 1$ and $1 ~times~ 1$. These correspond to
  162. levels 0 through 6, respectively.
  163. .P
  164. See the \f3glTexImage1D\fP reference page for a description of the
  165. acceptable values for the \f2type\fP parameter. See the \f3glDrawPixels\fP
  166. reference page for a description of the acceptable values
  167. for the \f2data\fP parameter.
  168. .SH NOTES
  169. Note that there is no direct way of querying the maximum level. This can
  170. be derived indirectly via \f3glGetTexLevelParameter\fP. First, query
  171. for the
  172. width actually used at level 0.
  173. (The width may not be equal to \f2width\fP since
  174. proxy textures might have scaled it to fit the implementation.)
  175. Then the maximum
  176. level can be derived from the formula ${log sub 2}(\f2width\fP)$.
  177. .P
  178. Formats \%\f3GL_BGR\fP, and \%\f3GL_BGRA\fP, and types
  179. \%\f3GL_UNSIGNED_BYTE_3_3_2\fP,
  180. \%\f3GL_UNSIGNED_BYTE_2_3_3_REV\fP,
  181. \%\f3GL_UNSIGNED_SHORT_5_6_5\fP,
  182. \%\f3GL_UNSIGNED_SHORT_5_6_5_REV\fP,
  183. \%\f3GL_UNSIGNED_SHORT_4_4_4_4\fP,
  184. \%\f3GL_UNSIGNED_SHORT_4_4_4_4_REV\fP,
  185. \%\f3GL_UNSIGNED_SHORT_5_5_5_1\fP,
  186. \%\f3GL_UNSIGNED_SHORT_1_5_5_5_REV\fP,
  187. \%\f3GL_UNSIGNED_INT_8_8_8_8\fP,
  188. \%\f3GL_UNSIGNED_INT_8_8_8_8_REV\fP,
  189. \%\f3GL_UNSIGNED_INT_10_10_10_2\fP, and
  190. \%\f3GL_UNSIGNED_INT_2_10_10_10_REV\fP are only available if the GL version
  191. is 1.2 or greater, and if the GLU version is 1.3 or greater.
  192. .SH ERRORS
  193. \%\f3GLU_INVALID_VALUE\fP is returned if \f2width\fP is < 1.
  194. .P
  195. \%\f3GLU_INVALID_ENUM\fP is returned if \f2format\fP or \f2type\fP are not legal.
  196. .P
  197. \%\f3GLU_INVALID_OPERATION\fP is returned if \f2type\fP is \%\f3GL_UNSIGNED_BYTE_3_3_2\fP or \%\f3GL_UNSIGNED_BYTE_2_3_3_REV\fP
  198. and \f2format\fP is not \%\f3GL_RGB\fP.
  199. .P
  200. \%\f3GLU_INVALID_OPERATION\fP is returned if \f2type\fP is \%\f3GL_UNSIGNED_SHORT_5_6_5\fP or \%\f3GL_UNSIGNED_SHORT_5_6_5_REV\fP
  201. and \f2format\fP is not \%\f3GL_RGB\fP.
  202. .P
  203. \%\f3GLU_INVALID_OPERATION\fP is returned if \f2type\fP is \%\f3GL_UNSIGNED_SHORT_4_4_4_4\fP or \%\f3GL_UNSIGNED_SHORT_4_4_4_4_REV\fP
  204. and \f2format\fP is neither \%\f3GL_RGBA\fP nor \%\f3GL_BGRA\fP.
  205. .P
  206. \%\f3GLU_INVALID_OPERATION\fP is returned if \f2type\fP is \%\f3GL_UNSIGNED_SHORT_5_5_5_1\fP or \%\f3GL_UNSIGNED_SHORT_1_5_5_5_REV\fP
  207. and \f2format\fP is neither \%\f3GL_RGBA\fP nor \%\f3GL_BGRA\fP.
  208. .P
  209. \%\f3GLU_INVALID_OPERATION\fP is returned if \f2type\fP is \%\f3GL_UNSIGNED_INT_8_8_8_8\fP or \%\f3GL_UNSIGNED_INT_8_8_8_8_REV\fP
  210. and \f2format\fP is neither \%\f3GL_RGBA\fP nor \%\f3GL_BGRA\fP.
  211. .P
  212. \%\f3GLU_INVALID_OPERATION\fP is returned if \f2type\fP is \%\f3GL_UNSIGNED_INT_10_10_10_2\fP or \%\f3GL_UNSIGNED_INT_2_10_10_10_REV\fP
  213. and \f2format\fP is neither \%\f3GL_RGBA\fP nor \%\f3GL_BGRA\fP.
  214. .SH SEE ALSO
  215. \f3glDrawPixels(3G)\fP,
  216. \f3glTexImage1D(3G)\fP,
  217. \f3glTexImage2D(3G)\fP,
  218. \f3glTexImage3D(3G)\fP,
  219. \%\f3gluBuild2DMipmaps(3G)\fP,
  220. \%\f3gluBuild3DMipmaps(3G)\fP,
  221. \%\f3gluErrorString(3G)\fP,
  222. \f3glGetTexImage(3G)\fP,
  223. \f3glGetTexLevelParameter(3G)\fP,
  224. \%\f3gluBuild1DMipmapLevels(3G)\fP,
  225. \%\f3gluBuild2DMipmapLevels(3G)\fP,
  226. \%\f3gluBuild3DMipmapLevels(3G)\fP