| 1 | <?xml version="1.0" encoding="UTF-8"?> |
| 2 | <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook MathML Module V1.1b1//EN" |
| 3 | "http://www.oasis-open.org/docbook/xml/mathml/1.1CR1/dbmathml.dtd"> |
| 4 | <refentry id="glXChooseVisual"> |
| 5 | <refmeta> |
| 6 | <refmetainfo> |
| 7 | <copyright> |
| 8 | <year>1991-2006</year> |
| 9 | <holder>Silicon Graphics, Inc.</holder> |
| 10 | </copyright> |
| 11 | </refmetainfo> |
| 12 | <refentrytitle>glXChooseVisual</refentrytitle> |
| 13 | <manvolnum>3G</manvolnum> |
| 14 | </refmeta> |
| 15 | <refnamediv> |
| 16 | <refname>glXChooseVisual</refname> |
| 17 | <refpurpose>return a visual that matches specified attributes</refpurpose> |
| 18 | </refnamediv> |
| 19 | <refsynopsisdiv><title>C Specification</title> |
| 20 | <funcsynopsis> |
| 21 | <funcprototype> |
| 22 | <funcdef>XVisualInfo* <function>glXChooseVisual</function></funcdef> |
| 23 | <paramdef>Display * <parameter>dpy</parameter></paramdef> |
| 24 | <paramdef>int <parameter>screen</parameter></paramdef> |
| 25 | <paramdef>int * <parameter>attribList</parameter></paramdef> |
| 26 | </funcprototype> |
| 27 | </funcsynopsis> |
| 28 | </refsynopsisdiv> |
| 29 | <!-- eqn: ignoring delim $$ --> |
| 30 | <refsect1 id="parameters"><title>Parameters</title> |
| 31 | <variablelist> |
| 32 | <varlistentry> |
| 33 | <term><parameter>dpy</parameter></term> |
| 34 | <listitem> |
| 35 | <para> |
| 36 | Specifies the connection to the X server. |
| 37 | </para> |
| 38 | </listitem> |
| 39 | </varlistentry> |
| 40 | <varlistentry> |
| 41 | <term><parameter>screen</parameter></term> |
| 42 | <listitem> |
| 43 | <para> |
| 44 | Specifies the screen number. |
| 45 | </para> |
| 46 | </listitem> |
| 47 | </varlistentry> |
| 48 | <varlistentry> |
| 49 | <term><parameter>attribList</parameter></term> |
| 50 | <listitem> |
| 51 | <para> |
| 52 | Specifies a list of boolean attributes and integer attribute/value pairs. |
| 53 | The last attribute must be <constant>None</constant>. |
| 54 | </para> |
| 55 | </listitem> |
| 56 | </varlistentry> |
| 57 | </variablelist> |
| 58 | </refsect1> |
| 59 | <refsect1 id="description"><title>Description</title> |
| 60 | <para> |
| 61 | <function>glXChooseVisual</function> returns a pointer to an XVisualInfo structure describing the visual |
| 62 | that best meets a minimum specification. |
| 63 | The boolean GLX attributes of the visual that is returned will match the |
| 64 | specified values, |
| 65 | and the integer GLX attributes will meet or exceed the specified |
| 66 | minimum values. |
| 67 | If all other attributes are equivalent, then TrueColor and PseudoColor |
| 68 | visuals have priority over DirectColor and StaticColor visuals, |
| 69 | respectively. |
| 70 | If no conforming visual exists, <constant>NULL</constant> is returned. |
| 71 | To free the data returned by this function, use <function>XFree</function>. |
| 72 | </para> |
| 73 | <para> |
| 74 | All boolean GLX attributes default to <constant>False</constant> |
| 75 | except <constant>GLX_USE_GL</constant>, |
| 76 | which defaults to <constant>True</constant>. |
| 77 | All integer GLX attributes default to zero. |
| 78 | Default specifications are superseded by attributes included in <parameter>attribList</parameter>. |
| 79 | Boolean attributes included in <parameter>attribList</parameter> are understood to be <constant>True</constant>. |
| 80 | Integer attributes and enumerated type attributes are followed immediately |
| 81 | by the corresponding desired or |
| 82 | minimum value. |
| 83 | The list must be terminated with <constant>None</constant>. |
| 84 | </para> |
| 85 | <para> |
| 86 | The interpretations of the various GLX visual attributes are as follows: |
| 87 | </para> |
| 88 | <variablelist> |
| 89 | <varlistentry> |
| 90 | <term><constant>GLX_USE_GL</constant></term> |
| 91 | <listitem> |
| 92 | <para> |
| 93 | Ignored. |
| 94 | Only visuals that can be rendered with GLX are considered. |
| 95 | </para> |
| 96 | </listitem> |
| 97 | </varlistentry> |
| 98 | <varlistentry> |
| 99 | <term><constant>GLX_BUFFER_SIZE</constant></term> |
| 100 | <listitem> |
| 101 | <para> |
| 102 | Must be followed by a nonnegative integer that indicates the desired |
| 103 | color index buffer size. |
| 104 | The smallest index buffer of at least the specified size is preferred. |
| 105 | Ignored if <constant>GLX_RGBA</constant> is asserted. |
| 106 | </para> |
| 107 | </listitem> |
| 108 | </varlistentry> |
| 109 | <varlistentry> |
| 110 | <term><constant>GLX_LEVEL</constant></term> |
| 111 | <listitem> |
| 112 | <para> |
| 113 | Must be followed by an integer buffer-level specification. |
| 114 | This specification is honored exactly. |
| 115 | Buffer level zero corresponds to the main frame buffer of the display. |
| 116 | Buffer level one is the first overlay frame buffer, level two the second |
| 117 | overlay frame buffer, and so on. |
| 118 | Negative buffer levels correspond to underlay frame buffers. |
| 119 | </para> |
| 120 | </listitem> |
| 121 | </varlistentry> |
| 122 | <varlistentry> |
| 123 | <term><constant>GLX_RGBA</constant></term> |
| 124 | <listitem> |
| 125 | <para> |
| 126 | If present, |
| 127 | only TrueColor and DirectColor visuals are considered. |
| 128 | Otherwise, |
| 129 | only PseudoColor and StaticColor visuals are considered. |
| 130 | </para> |
| 131 | </listitem> |
| 132 | </varlistentry> |
| 133 | <varlistentry> |
| 134 | <term><constant>GLX_DOUBLEBUFFER</constant></term> |
| 135 | <listitem> |
| 136 | <para> |
| 137 | If present, |
| 138 | only double-buffered visuals are considered. |
| 139 | Otherwise, |
| 140 | only single-buffered visuals are considered. |
| 141 | </para> |
| 142 | </listitem> |
| 143 | </varlistentry> |
| 144 | <varlistentry> |
| 145 | <term><constant>GLX_STEREO</constant></term> |
| 146 | <listitem> |
| 147 | <para> |
| 148 | If present, |
| 149 | only stereo visuals are considered. |
| 150 | Otherwise, |
| 151 | only monoscopic visuals are considered. |
| 152 | </para> |
| 153 | </listitem> |
| 154 | </varlistentry> |
| 155 | <varlistentry> |
| 156 | <term><constant>GLX_AUX_BUFFERS</constant></term> |
| 157 | <listitem> |
| 158 | <para> |
| 159 | Must be followed by a nonnegative integer that indicates the desired |
| 160 | number of auxiliary buffers. |
| 161 | Visuals with the |
| 162 | smallest number of auxiliary buffers that meets or exceeds |
| 163 | the specified number are preferred. |
| 164 | </para> |
| 165 | </listitem> |
| 166 | </varlistentry> |
| 167 | <varlistentry> |
| 168 | <term><constant>GLX_RED_SIZE</constant></term> |
| 169 | <listitem> |
| 170 | <para> |
| 171 | Must be followed by a nonnegative minimum size specification. |
| 172 | If this value is zero, |
| 173 | the smallest available red buffer is preferred. |
| 174 | Otherwise, the largest available red buffer of at least the minimum size |
| 175 | is preferred. |
| 176 | </para> |
| 177 | </listitem> |
| 178 | </varlistentry> |
| 179 | <varlistentry> |
| 180 | <term><constant>GLX_GREEN_SIZE</constant></term> |
| 181 | <listitem> |
| 182 | <para> |
| 183 | Must be followed by a nonnegative minimum size specification. |
| 184 | If this value is zero, |
| 185 | the smallest available green buffer is preferred. |
| 186 | Otherwise, the largest available green buffer of at least the minimum size |
| 187 | is preferred. |
| 188 | </para> |
| 189 | </listitem> |
| 190 | </varlistentry> |
| 191 | <varlistentry> |
| 192 | <term><constant>GLX_BLUE_SIZE</constant></term> |
| 193 | <listitem> |
| 194 | <para> |
| 195 | Must be followed by a nonnegative minimum size specification. |
| 196 | If this value is zero, |
| 197 | the smallest available blue buffer is preferred. |
| 198 | Otherwise, the largest available blue buffer of at least the minimum size |
| 199 | is preferred. |
| 200 | </para> |
| 201 | </listitem> |
| 202 | </varlistentry> |
| 203 | <varlistentry> |
| 204 | <term><constant>GLX_ALPHA_SIZE</constant></term> |
| 205 | <listitem> |
| 206 | <para> |
| 207 | Must be followed by a nonnegative minimum size specification. |
| 208 | If this value is zero, |
| 209 | the smallest available alpha buffer is preferred. |
| 210 | Otherwise, the largest available alpha buffer of at least the minimum size |
| 211 | is preferred. |
| 212 | </para> |
| 213 | </listitem> |
| 214 | </varlistentry> |
| 215 | <varlistentry> |
| 216 | <term><constant>GLX_DEPTH_SIZE</constant></term> |
| 217 | <listitem> |
| 218 | <para> |
| 219 | Must be followed by a nonnegative minimum size specification. |
| 220 | If this value is zero, |
| 221 | visuals with no depth buffer are preferred. |
| 222 | Otherwise, the largest available depth buffer of at least the minimum size |
| 223 | is preferred. |
| 224 | </para> |
| 225 | </listitem> |
| 226 | </varlistentry> |
| 227 | <varlistentry> |
| 228 | <term><constant>GLX_STENCIL_SIZE</constant></term> |
| 229 | <listitem> |
| 230 | <para> |
| 231 | Must be followed by a nonnegative integer that indicates the desired |
| 232 | number of stencil bitplanes. |
| 233 | The smallest stencil buffer of at least the specified size is preferred. |
| 234 | If the desired value is zero, |
| 235 | visuals with no stencil buffer are preferred. |
| 236 | </para> |
| 237 | </listitem> |
| 238 | </varlistentry> |
| 239 | <varlistentry> |
| 240 | <term><constant>GLX_ACCUM_RED_SIZE</constant></term> |
| 241 | <listitem> |
| 242 | <para> |
| 243 | Must be followed by a nonnegative minimum size specification. |
| 244 | If this value is zero, |
| 245 | visuals with no red accumulation buffer are preferred. |
| 246 | Otherwise, the largest possible red accumulation buffer |
| 247 | of at least the minimum size is preferred. |
| 248 | </para> |
| 249 | </listitem> |
| 250 | </varlistentry> |
| 251 | <varlistentry> |
| 252 | <term><constant>GLX_ACCUM_GREEN_SIZE</constant></term> |
| 253 | <listitem> |
| 254 | <para> |
| 255 | Must be followed by a nonnegative minimum size specification. |
| 256 | If this value is zero, |
| 257 | visuals with no green accumulation buffer are preferred. |
| 258 | Otherwise, the largest possible green accumulation buffer |
| 259 | of at least the minimum size is preferred. |
| 260 | </para> |
| 261 | </listitem> |
| 262 | </varlistentry> |
| 263 | <varlistentry> |
| 264 | <term><constant>GLX_ACCUM_BLUE_SIZE</constant></term> |
| 265 | <listitem> |
| 266 | <para> |
| 267 | Must be followed by a nonnegative minimum size specification. |
| 268 | If this value is zero, |
| 269 | visuals with no blue accumulation buffer are preferred. |
| 270 | Otherwise, the largest possible blue accumulation buffer |
| 271 | of at least the minimum size is preferred. |
| 272 | </para> |
| 273 | </listitem> |
| 274 | </varlistentry> |
| 275 | <varlistentry> |
| 276 | <term><constant>GLX_ACCUM_ALPHA_SIZE</constant></term> |
| 277 | <listitem> |
| 278 | <para> |
| 279 | Must be followed by a nonnegative minimum size specification. |
| 280 | If this value is zero, |
| 281 | visuals with no alpha accumulation buffer are preferred. |
| 282 | Otherwise, the largest possible alpha accumulation buffer |
| 283 | of at least the minimum size is preferred. |
| 284 | </para> |
| 285 | </listitem> |
| 286 | </varlistentry> |
| 287 | </variablelist> |
| 288 | </refsect1> |
| 289 | <refsect1 id="examples"><title>Examples</title> |
| 290 | <para> |
| 291 | </para> |
| 292 | <variablelist> |
| 293 | <varlistentry> |
| 294 | <term><parameter>attribList</parameter> =</term> |
| 295 | <listitem> |
| 296 | <para> |
| 297 | {<constant>GLX_RGBA</constant>, |
| 298 | <constant>GLX_RED_SIZE</constant>, 4, |
| 299 | <constant>GLX_GREEN_SIZE</constant>, 4, |
| 300 | <constant>GLX_BLUE_SIZE</constant>, 4, |
| 301 | <constant>None</constant>}; |
| 302 | </para> |
| 303 | </listitem> |
| 304 | </varlistentry> |
| 305 | </variablelist> |
| 306 | <para> |
| 307 | Specifies a single-buffered RGB visual in the normal frame buffer, |
| 308 | not an overlay or underlay buffer. |
| 309 | The returned visual supports at least four bits each of red, |
| 310 | green, and blue, |
| 311 | and possibly no bits of alpha. |
| 312 | It does not support color index mode, |
| 313 | double-buffering, or stereo display. |
| 314 | It may or may not have one or more auxiliary color buffers, |
| 315 | a depth buffer, |
| 316 | a stencil buffer, |
| 317 | or an accumulation buffer. |
| 318 | </para> |
| 319 | </refsect1> |
| 320 | <refsect1 id="notes"><title>Notes</title> |
| 321 | <para> |
| 322 | <constant>XVisualInfo</constant> is defined in <emphasis>Xutil.h.</emphasis> |
| 323 | It is a structure that includes <emphasis>visual</emphasis>, <emphasis>visualID</emphasis>, <emphasis>screen</emphasis>, and |
| 324 | <emphasis>depth</emphasis> elements. |
| 325 | </para> |
| 326 | <para> |
| 327 | <function>glXChooseVisual</function> is implemented as a client-side utility using only <function>XGetVisualInfo</function> |
| 328 | and <citerefentry><refentrytitle>glXGetConfig</refentrytitle></citerefentry>. |
| 329 | Calls to these two routines can be used to implement selection algorithms |
| 330 | other than the generic one implemented by <function>glXChooseVisual</function>. |
| 331 | </para> |
| 332 | <para> |
| 333 | GLX implementations are strongly discouraged, |
| 334 | but not proscribed, |
| 335 | from changing the selection algorithm used by <function>glXChooseVisual</function>. |
| 336 | Therefore, selections may change from release to release |
| 337 | of the client-side library. |
| 338 | </para> |
| 339 | <para> |
| 340 | There is no direct filter for picking only visuals that |
| 341 | support GLXPixmaps. |
| 342 | GLXPixmaps are supported for visuals whose |
| 343 | <constant>GLX_BUFFER_SIZE</constant> |
| 344 | is one of the pixmap depths supported by the X server. |
| 345 | </para> |
| 346 | </refsect1> |
| 347 | <refsect1 id="errors"><title>Errors</title> |
| 348 | <para> |
| 349 | <constant>NULL</constant> is returned if an undefined GLX attribute is encountered in |
| 350 | <parameter>attribList</parameter>. |
| 351 | </para> |
| 352 | </refsect1> |
| 353 | <refsect1 id="seealso"><title>See Also</title> |
| 354 | <para> |
| 355 | <citerefentry><refentrytitle>glXCreateContext</refentrytitle></citerefentry>, |
| 356 | <citerefentry><refentrytitle>glXGetConfig</refentrytitle></citerefentry> |
| 357 | </para> |
| 358 | </refsect1> |
| 359 | <refsect1 id="Copyright"><title>Copyright</title> |
| 360 | <para> |
| 361 | Copyright <trademark class="copyright"></trademark> 1991-2006 |
| 362 | Silicon Graphics, Inc. This document is licensed under the SGI |
| 363 | Free Software B License. For details, see |
| 364 | <ulink url="http://oss.sgi.com/projects/FreeB/">http://oss.sgi.com/projects/FreeB/</ulink>. |
| 365 | </para> |
| 366 | </refsect1> |
| 367 | </refentry> |