/usr/share/doc/libghc-glut-doc/html/src/Graphics-UI-GLUT-Initialization.html is in libghc-glut-doc 2.4.0.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 | <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<!-- Generated by HsColour, http://code.haskell.org/~malcolm/hscolour/ -->
<title>Graphics/UI/GLUT/Initialization.hs</title>
<link type='text/css' rel='stylesheet' href='hscolour.css' />
</head>
<body>
<pre><a name="line-1"></a><span class='hs-comment'>--------------------------------------------------------------------------------</span>
<a name="line-2"></a><span class='hs-comment'>-- |</span>
<a name="line-3"></a><span class='hs-comment'>-- Module : Graphics.UI.GLUT.Initialization</span>
<a name="line-4"></a><span class='hs-comment'>-- Copyright : (c) Sven Panne 2002-2005</span>
<a name="line-5"></a><span class='hs-comment'>-- License : BSD-style (see the file libraries/GLUT/LICENSE)</span>
<a name="line-6"></a><span class='hs-comment'>--</span>
<a name="line-7"></a><span class='hs-comment'>-- Maintainer : sven.panne@aedion.de</span>
<a name="line-8"></a><span class='hs-comment'>-- Stability : stable</span>
<a name="line-9"></a><span class='hs-comment'>-- Portability : portable</span>
<a name="line-10"></a><span class='hs-comment'>--</span>
<a name="line-11"></a><span class='hs-comment'>-- Actions and state variables in this module are used to initialize GLUT state.</span>
<a name="line-12"></a><span class='hs-comment'>-- The primary initialization routine is 'initialize', which should only be</span>
<a name="line-13"></a><span class='hs-comment'>-- called exactly once in a GLUT program. No other GLUT or OpenGL actions should</span>
<a name="line-14"></a><span class='hs-comment'>-- be called before 'initialize', apart from getting or setting the state</span>
<a name="line-15"></a><span class='hs-comment'>-- variables in this module.</span>
<a name="line-16"></a><span class='hs-comment'>--</span>
<a name="line-17"></a><span class='hs-comment'>-- The reason is that these state variables can be used to set default window</span>
<a name="line-18"></a><span class='hs-comment'>-- initialization state that might be modified by the command processing done in</span>
<a name="line-19"></a><span class='hs-comment'>-- 'initialize'. For example, 'initialWindowSize' can be set to @('Size'</span>
<a name="line-20"></a><span class='hs-comment'>-- 400 400)@ before 'initialize' is called to indicate 400 by 400 is the</span>
<a name="line-21"></a><span class='hs-comment'>-- program\'s default window size. Setting the initial window size or position</span>
<a name="line-22"></a><span class='hs-comment'>-- before 'initialize' allows the GLUT program user to specify the initial size</span>
<a name="line-23"></a><span class='hs-comment'>-- or position using command line arguments.</span>
<a name="line-24"></a><span class='hs-comment'>--</span>
<a name="line-25"></a><span class='hs-comment'>--------------------------------------------------------------------------------</span>
<a name="line-26"></a>
<a name="line-27"></a><span class='hs-keyword'>module</span> <span class='hs-conid'>Graphics</span><span class='hs-varop'>.</span><span class='hs-conid'>UI</span><span class='hs-varop'>.</span><span class='hs-conid'>GLUT</span><span class='hs-varop'>.</span><span class='hs-conid'>Initialization</span> <span class='hs-layout'>(</span>
<a name="line-28"></a> <span class='hs-comment'>-- * Primary initialization</span>
<a name="line-29"></a> <span class='hs-varid'>initialize</span><span class='hs-layout'>,</span> <span class='hs-varid'>getArgsAndInitialize</span><span class='hs-layout'>,</span> <span class='hs-varid'>exit</span><span class='hs-layout'>,</span>
<a name="line-30"></a>
<a name="line-31"></a> <span class='hs-comment'>-- * Initial window geometry</span>
<a name="line-32"></a> <span class='hs-varid'>initialWindowPosition</span><span class='hs-layout'>,</span> <span class='hs-varid'>initialWindowSize</span><span class='hs-layout'>,</span>
<a name="line-33"></a>
<a name="line-34"></a> <span class='hs-comment'>-- * Setting the initial display mode (I)</span>
<a name="line-35"></a> <span class='hs-conid'>DisplayMode</span><span class='hs-layout'>(</span><span class='hs-keyglyph'>..</span><span class='hs-layout'>)</span><span class='hs-layout'>,</span> <span class='hs-varid'>initialDisplayMode</span><span class='hs-layout'>,</span> <span class='hs-varid'>displayModePossible</span><span class='hs-layout'>,</span>
<a name="line-36"></a>
<a name="line-37"></a> <span class='hs-comment'>-- * Setting the initial display mode (II)</span>
<a name="line-38"></a> <span class='hs-conid'>DisplayCapability</span><span class='hs-layout'>(</span><span class='hs-keyglyph'>..</span><span class='hs-layout'>)</span><span class='hs-layout'>,</span> <span class='hs-conid'>Relation</span><span class='hs-layout'>(</span><span class='hs-keyglyph'>..</span><span class='hs-layout'>)</span><span class='hs-layout'>,</span> <span class='hs-conid'>DisplayCapabilityDescription</span><span class='hs-layout'>(</span><span class='hs-keyglyph'>..</span><span class='hs-layout'>)</span><span class='hs-layout'>,</span>
<a name="line-39"></a> <span class='hs-varid'>initialDisplayCapabilities</span><span class='hs-layout'>,</span>
<a name="line-40"></a>
<a name="line-41"></a> <span class='hs-comment'>-- * Controlling the creation of rendering contexts</span>
<a name="line-42"></a> <span class='hs-conid'>RenderingContext</span><span class='hs-layout'>(</span><span class='hs-keyglyph'>..</span><span class='hs-layout'>)</span><span class='hs-layout'>,</span> <span class='hs-varid'>renderingContext</span><span class='hs-layout'>,</span>
<a name="line-43"></a>
<a name="line-44"></a> <span class='hs-comment'>-- * Direct\/indirect rendering</span>
<a name="line-45"></a> <span class='hs-conid'>DirectRendering</span><span class='hs-layout'>(</span><span class='hs-keyglyph'>..</span><span class='hs-layout'>)</span><span class='hs-layout'>,</span> <span class='hs-varid'>directRendering</span><span class='hs-layout'>,</span>
<a name="line-46"></a>
<a name="line-47"></a> <span class='hs-comment'>-- * OpenGL 3.x context support</span>
<a name="line-48"></a> <span class='hs-varid'>initialContextVersion</span><span class='hs-layout'>,</span> <span class='hs-conid'>ContextFlag</span><span class='hs-layout'>(</span><span class='hs-keyglyph'>..</span><span class='hs-layout'>)</span><span class='hs-layout'>,</span> <span class='hs-varid'>initialContextFlags</span><span class='hs-layout'>,</span>
<a name="line-49"></a> <span class='hs-conid'>ContextProfile</span><span class='hs-layout'>(</span><span class='hs-keyglyph'>..</span><span class='hs-layout'>)</span><span class='hs-layout'>,</span> <span class='hs-varid'>initialContextProfile</span>
<a name="line-50"></a><span class='hs-layout'>)</span> <span class='hs-keyword'>where</span>
<a name="line-51"></a>
<a name="line-52"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Control</span><span class='hs-varop'>.</span><span class='hs-conid'>Monad</span>
<a name="line-53"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Data</span><span class='hs-varop'>.</span><span class='hs-conid'>Bits</span>
<a name="line-54"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Data</span><span class='hs-varop'>.</span><span class='hs-conid'>List</span>
<a name="line-55"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Foreign</span><span class='hs-varop'>.</span><span class='hs-conid'>C</span><span class='hs-varop'>.</span><span class='hs-conid'>String</span>
<a name="line-56"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Foreign</span><span class='hs-varop'>.</span><span class='hs-conid'>C</span><span class='hs-varop'>.</span><span class='hs-conid'>Types</span>
<a name="line-57"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Foreign</span><span class='hs-varop'>.</span><span class='hs-conid'>Marshal</span><span class='hs-varop'>.</span><span class='hs-conid'>Array</span>
<a name="line-58"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Foreign</span><span class='hs-varop'>.</span><span class='hs-conid'>Marshal</span><span class='hs-varop'>.</span><span class='hs-conid'>Utils</span>
<a name="line-59"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Foreign</span><span class='hs-varop'>.</span><span class='hs-conid'>Ptr</span>
<a name="line-60"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Foreign</span><span class='hs-varop'>.</span><span class='hs-conid'>Storable</span>
<a name="line-61"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Graphics</span><span class='hs-varop'>.</span><span class='hs-conid'>Rendering</span><span class='hs-varop'>.</span><span class='hs-conid'>OpenGL</span> <span class='hs-layout'>(</span> <span class='hs-conid'>Position</span><span class='hs-layout'>(</span><span class='hs-keyglyph'>..</span><span class='hs-layout'>)</span><span class='hs-layout'>,</span> <span class='hs-conid'>Size</span><span class='hs-layout'>(</span><span class='hs-keyglyph'>..</span><span class='hs-layout'>)</span>
<a name="line-62"></a> <span class='hs-layout'>,</span> <span class='hs-conid'>StateVar</span><span class='hs-layout'>,</span> <span class='hs-conid'>GettableStateVar</span><span class='hs-layout'>,</span> <span class='hs-varid'>get</span>
<a name="line-63"></a> <span class='hs-layout'>,</span> <span class='hs-conid'>SettableStateVar</span><span class='hs-layout'>,</span> <span class='hs-varid'>makeStateVar</span><span class='hs-layout'>,</span> <span class='hs-layout'>(</span><span class='hs-varop'>$=</span><span class='hs-layout'>)</span>
<a name="line-64"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>makeGettableStateVar</span>
<a name="line-65"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>makeSettableStateVar</span> <span class='hs-layout'>)</span>
<a name="line-66"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Graphics</span><span class='hs-varop'>.</span><span class='hs-conid'>UI</span><span class='hs-varop'>.</span><span class='hs-conid'>GLUT</span><span class='hs-varop'>.</span><span class='hs-conid'>QueryUtils</span>
<a name="line-67"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Graphics</span><span class='hs-varop'>.</span><span class='hs-conid'>UI</span><span class='hs-varop'>.</span><span class='hs-conid'>GLUT</span><span class='hs-varop'>.</span><span class='hs-conid'>Raw</span>
<a name="line-68"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Graphics</span><span class='hs-varop'>.</span><span class='hs-conid'>UI</span><span class='hs-varop'>.</span><span class='hs-conid'>GLUT</span><span class='hs-varop'>.</span><span class='hs-conid'>Types</span>
<a name="line-69"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>System</span><span class='hs-varop'>.</span><span class='hs-conid'>Environment</span>
<a name="line-70"></a>
<a name="line-71"></a><span class='hs-comment'>--------------------------------------------------------------------------------</span>
<a name="line-72"></a>
<a name="line-73"></a><span class='hs-comment'>-- | Given the program name and command line arguments, initialize the GLUT</span>
<a name="line-74"></a><span class='hs-comment'>-- library and negotiate a session with the window system. During this</span>
<a name="line-75"></a><span class='hs-comment'>-- process, 'initialize' may cause the termination of the GLUT program with an</span>
<a name="line-76"></a><span class='hs-comment'>-- error message to the user if GLUT cannot be properly initialized.</span>
<a name="line-77"></a><span class='hs-comment'>-- Examples of this situation include the failure to connect to the window</span>
<a name="line-78"></a><span class='hs-comment'>-- system, the lack of window system support for OpenGL, and invalid command</span>
<a name="line-79"></a><span class='hs-comment'>-- line options.</span>
<a name="line-80"></a><span class='hs-comment'>--</span>
<a name="line-81"></a><span class='hs-comment'>-- 'initialize' also processes command line options, but the specific options</span>
<a name="line-82"></a><span class='hs-comment'>-- parsed are window system dependent. Any command line arguments which are</span>
<a name="line-83"></a><span class='hs-comment'>-- not GLUT-specific are returned.</span>
<a name="line-84"></a><span class='hs-comment'>--</span>
<a name="line-85"></a><span class='hs-comment'>-- /X Implementation Notes:/ The X Window System specific options parsed by</span>
<a name="line-86"></a><span class='hs-comment'>-- 'initialize' are as follows:</span>
<a name="line-87"></a><span class='hs-comment'>--</span>
<a name="line-88"></a><span class='hs-comment'>-- * @-display /DISPLAY/@: Specify the X server to connect to. If not specified,</span>
<a name="line-89"></a><span class='hs-comment'>-- the value of the @DISPLAY@ environment variable is used.</span>
<a name="line-90"></a><span class='hs-comment'>--</span>
<a name="line-91"></a><span class='hs-comment'>-- * @-geometry /WxH+X+Y/@: Determines where windows should be created on the</span>
<a name="line-92"></a><span class='hs-comment'>-- screen. The parameter following @-geometry@ should be formatted as a</span>
<a name="line-93"></a><span class='hs-comment'>-- standard X geometry specification. The effect of using this option is to</span>
<a name="line-94"></a><span class='hs-comment'>-- change the GLUT initial size and initial position the same as if</span>
<a name="line-95"></a><span class='hs-comment'>-- 'initialWindowSize' or 'initialWindowPosition' were modified directly.</span>
<a name="line-96"></a><span class='hs-comment'>--</span>
<a name="line-97"></a><span class='hs-comment'>-- * @-iconic@: Requests all top-level windows be created in an iconic state.</span>
<a name="line-98"></a><span class='hs-comment'>--</span>
<a name="line-99"></a><span class='hs-comment'>-- * @-indirect@: Force the use of indirect OpenGL rendering contexts.</span>
<a name="line-100"></a><span class='hs-comment'>--</span>
<a name="line-101"></a><span class='hs-comment'>-- * @-direct@: Force the use of direct OpenGL rendering contexts (not all GLX</span>
<a name="line-102"></a><span class='hs-comment'>-- implementations support direct rendering contexts). A fatal error is</span>
<a name="line-103"></a><span class='hs-comment'>-- generated if direct rendering is not supported by the OpenGL</span>
<a name="line-104"></a><span class='hs-comment'>-- implementation. If neither @-indirect@ or @-direct@ are used to force a</span>
<a name="line-105"></a><span class='hs-comment'>-- particular behavior, GLUT will attempt to use direct rendering if</span>
<a name="line-106"></a><span class='hs-comment'>-- possible and otherwise fallback to indirect rendering.</span>
<a name="line-107"></a><span class='hs-comment'>--</span>
<a name="line-108"></a><span class='hs-comment'>-- * @-gldebug@: After processing callbacks and\/or events, call</span>
<a name="line-109"></a><span class='hs-comment'>-- 'Graphics.UI.GLUT.Debugging.reportErrors' to check if there are any pending</span>
<a name="line-110"></a><span class='hs-comment'>-- OpenGL errors. Using this option is helpful in detecting OpenGL run-time</span>
<a name="line-111"></a><span class='hs-comment'>-- errors.</span>
<a name="line-112"></a><span class='hs-comment'>--</span>
<a name="line-113"></a><span class='hs-comment'>-- * @-sync@: Enable synchronous X protocol transactions. This option makes</span>
<a name="line-114"></a><span class='hs-comment'>-- it easier to track down potential X protocol errors.</span>
<a name="line-115"></a>
<a name="line-116"></a><a name="initialize"></a><span class='hs-definition'>initialize</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>String</span> <span class='hs-comment'>-- ^ The program name.</span>
<a name="line-117"></a> <span class='hs-keyglyph'>-></span> <span class='hs-keyglyph'>[</span><span class='hs-conid'>String</span><span class='hs-keyglyph'>]</span> <span class='hs-comment'>-- ^ The command line arguments</span>
<a name="line-118"></a> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>IO</span> <span class='hs-keyglyph'>[</span><span class='hs-conid'>String</span><span class='hs-keyglyph'>]</span> <span class='hs-comment'>-- ^ Non-GLUT command line arguments</span>
<a name="line-119"></a><span class='hs-definition'>initialize</span> <span class='hs-varid'>prog</span> <span class='hs-varid'>args</span> <span class='hs-keyglyph'>=</span>
<a name="line-120"></a> <span class='hs-varid'>with</span> <span class='hs-layout'>(</span><span class='hs-num'>1</span> <span class='hs-varop'>+</span> <span class='hs-varid'>genericLength</span> <span class='hs-varid'>args</span><span class='hs-layout'>)</span> <span class='hs-varop'>$</span> <span class='hs-keyglyph'>\</span><span class='hs-varid'>argcBuf</span> <span class='hs-keyglyph'>-></span>
<a name="line-121"></a> <span class='hs-varid'>withMany</span> <span class='hs-varid'>withCString</span> <span class='hs-layout'>(</span><span class='hs-varid'>prog</span> <span class='hs-conop'>:</span> <span class='hs-varid'>args</span><span class='hs-layout'>)</span> <span class='hs-varop'>$</span> <span class='hs-keyglyph'>\</span><span class='hs-varid'>argvPtrs</span> <span class='hs-keyglyph'>-></span>
<a name="line-122"></a> <span class='hs-varid'>withArray0</span> <span class='hs-varid'>nullPtr</span> <span class='hs-varid'>argvPtrs</span> <span class='hs-varop'>$</span> <span class='hs-keyglyph'>\</span><span class='hs-varid'>argvBuf</span> <span class='hs-keyglyph'>-></span> <span class='hs-keyword'>do</span>
<a name="line-123"></a> <span class='hs-varid'>glutInit</span> <span class='hs-varid'>argcBuf</span> <span class='hs-varid'>argvBuf</span>
<a name="line-124"></a> <span class='hs-varid'>newArgc</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>peek</span> <span class='hs-varid'>argcBuf</span>
<a name="line-125"></a> <span class='hs-varid'>newArgvPtrs</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>peekArray</span> <span class='hs-layout'>(</span><span class='hs-varid'>fromIntegral</span> <span class='hs-varid'>newArgc</span><span class='hs-layout'>)</span> <span class='hs-varid'>argvBuf</span>
<a name="line-126"></a> <span class='hs-varid'>newArgv</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>mapM</span> <span class='hs-varid'>peekCString</span> <span class='hs-varid'>newArgvPtrs</span>
<a name="line-127"></a> <span class='hs-varid'>return</span> <span class='hs-varop'>$</span> <span class='hs-varid'>tail</span> <span class='hs-varid'>newArgv</span>
<a name="line-128"></a>
<a name="line-129"></a><span class='hs-comment'>-- | Convenience action: Initialize GLUT, returning the program name and any</span>
<a name="line-130"></a><span class='hs-comment'>-- non-GLUT command line arguments.</span>
<a name="line-131"></a>
<a name="line-132"></a><a name="getArgsAndInitialize"></a><span class='hs-definition'>getArgsAndInitialize</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>IO</span> <span class='hs-layout'>(</span><span class='hs-conid'>String</span><span class='hs-layout'>,</span> <span class='hs-keyglyph'>[</span><span class='hs-conid'>String</span><span class='hs-keyglyph'>]</span><span class='hs-layout'>)</span>
<a name="line-133"></a><span class='hs-definition'>getArgsAndInitialize</span> <span class='hs-keyglyph'>=</span> <span class='hs-keyword'>do</span>
<a name="line-134"></a> <span class='hs-varid'>prog</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>getProgName</span>
<a name="line-135"></a> <span class='hs-varid'>args</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>getArgs</span>
<a name="line-136"></a> <span class='hs-varid'>nonGLUTArgs</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>initialize</span> <span class='hs-varid'>prog</span> <span class='hs-varid'>args</span>
<a name="line-137"></a> <span class='hs-varid'>return</span> <span class='hs-layout'>(</span><span class='hs-varid'>prog</span><span class='hs-layout'>,</span> <span class='hs-varid'>nonGLUTArgs</span><span class='hs-layout'>)</span>
<a name="line-138"></a>
<a name="line-139"></a><span class='hs-comment'>-----------------------------------------------------------------------------</span>
<a name="line-140"></a>
<a name="line-141"></a><span class='hs-comment'>-- | (/freeglut only/) De-initialize GLUT. After this, one has to use</span>
<a name="line-142"></a><span class='hs-comment'>-- 'initialize' or 'getArgsAndInitialize' to initialize GLUT again.</span>
<a name="line-143"></a>
<a name="line-144"></a><a name="exit"></a><span class='hs-definition'>exit</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>IO</span> <span class='hs-conid'>()</span>
<a name="line-145"></a><span class='hs-definition'>exit</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>glutExit</span>
<a name="line-146"></a>
<a name="line-147"></a><span class='hs-comment'>--------------------------------------------------------------------------------</span>
<a name="line-148"></a>
<a name="line-149"></a><span class='hs-comment'>-- | Controls the /initial window position/. Windows created by</span>
<a name="line-150"></a><span class='hs-comment'>-- 'Graphics.UI.GLUT.Window.createWindow' will be requested to be created with</span>
<a name="line-151"></a><span class='hs-comment'>-- the current /initial window position/. The initial value of the /initial</span>
<a name="line-152"></a><span class='hs-comment'>-- window position/ GLUT state is @'Position' (-1) (-1)@. If either the X or Y</span>
<a name="line-153"></a><span class='hs-comment'>-- component of the /initial window position/ is negative, the actual window</span>
<a name="line-154"></a><span class='hs-comment'>-- position is left to the window system to determine.</span>
<a name="line-155"></a><span class='hs-comment'>--</span>
<a name="line-156"></a><span class='hs-comment'>-- The intent of the /initial window position/ is to provide a suggestion to</span>
<a name="line-157"></a><span class='hs-comment'>-- the window system for a window\'s initial position. The window system is</span>
<a name="line-158"></a><span class='hs-comment'>-- not obligated to use this information. Therefore, GLUT programs should not</span>
<a name="line-159"></a><span class='hs-comment'>-- assume the window was created at the specified position.</span>
<a name="line-160"></a>
<a name="line-161"></a><a name="initialWindowPosition"></a><span class='hs-definition'>initialWindowPosition</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>StateVar</span> <span class='hs-conid'>Position</span>
<a name="line-162"></a><span class='hs-definition'>initialWindowPosition</span> <span class='hs-keyglyph'>=</span>
<a name="line-163"></a> <span class='hs-varid'>makeStateVar</span> <span class='hs-varid'>getInitialWindowPosition</span> <span class='hs-varid'>setInitialWindowPosition</span>
<a name="line-164"></a>
<a name="line-165"></a><a name="getInitialWindowPosition"></a><span class='hs-definition'>getInitialWindowPosition</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>IO</span> <span class='hs-conid'>Position</span>
<a name="line-166"></a><span class='hs-definition'>getInitialWindowPosition</span> <span class='hs-keyglyph'>=</span> <span class='hs-keyword'>do</span>
<a name="line-167"></a> <span class='hs-varid'>x</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>simpleGet</span> <span class='hs-varid'>fromIntegral</span> <span class='hs-varid'>glut_INIT_WINDOW_X</span>
<a name="line-168"></a> <span class='hs-varid'>y</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>simpleGet</span> <span class='hs-varid'>fromIntegral</span> <span class='hs-varid'>glut_INIT_WINDOW_Y</span>
<a name="line-169"></a> <span class='hs-varid'>return</span> <span class='hs-varop'>$</span> <span class='hs-conid'>Position</span> <span class='hs-varid'>x</span> <span class='hs-varid'>y</span>
<a name="line-170"></a>
<a name="line-171"></a><a name="setInitialWindowPosition"></a><span class='hs-definition'>setInitialWindowPosition</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Position</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>IO</span> <span class='hs-conid'>()</span>
<a name="line-172"></a><span class='hs-definition'>setInitialWindowPosition</span> <span class='hs-layout'>(</span><span class='hs-conid'>Position</span> <span class='hs-varid'>x</span> <span class='hs-varid'>y</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>=</span>
<a name="line-173"></a> <span class='hs-varid'>glutInitWindowPosition</span> <span class='hs-layout'>(</span><span class='hs-varid'>fromIntegral</span> <span class='hs-varid'>x</span><span class='hs-layout'>)</span> <span class='hs-layout'>(</span><span class='hs-varid'>fromIntegral</span> <span class='hs-varid'>y</span><span class='hs-layout'>)</span>
<a name="line-174"></a>
<a name="line-175"></a><span class='hs-comment'>--------------------------------------------------------------------------------</span>
<a name="line-176"></a>
<a name="line-177"></a><span class='hs-comment'>-- | Controls the /initial window size/. Windows created by</span>
<a name="line-178"></a><span class='hs-comment'>-- 'Graphics.UI.GLUT.Window.createWindow' will be requested to be created with</span>
<a name="line-179"></a><span class='hs-comment'>-- the current /initial window size/. The initial value of the /initial window</span>
<a name="line-180"></a><span class='hs-comment'>-- size/ GLUT state is @'Size' 300 300@. If either the width or the height</span>
<a name="line-181"></a><span class='hs-comment'>-- component of the /initial window size/ is non-positive, the actual window</span>
<a name="line-182"></a><span class='hs-comment'>-- size is left to the window system to determine.</span>
<a name="line-183"></a><span class='hs-comment'>--</span>
<a name="line-184"></a><span class='hs-comment'>-- The intent of the /initial window size/ is to provide a suggestion to the</span>
<a name="line-185"></a><span class='hs-comment'>-- window system for a window\'s initial size. The window system is not</span>
<a name="line-186"></a><span class='hs-comment'>-- obligated to use this information. Therefore, GLUT programs should not</span>
<a name="line-187"></a><span class='hs-comment'>-- assume the window was created at the specified size. A GLUT program should</span>
<a name="line-188"></a><span class='hs-comment'>-- use the window\'s reshape callback to determine the true size of the</span>
<a name="line-189"></a><span class='hs-comment'>-- window.</span>
<a name="line-190"></a>
<a name="line-191"></a><a name="initialWindowSize"></a><span class='hs-definition'>initialWindowSize</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>StateVar</span> <span class='hs-conid'>Size</span>
<a name="line-192"></a><span class='hs-definition'>initialWindowSize</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>makeStateVar</span> <span class='hs-varid'>getInitialWindowSize</span> <span class='hs-varid'>setInitialWindowSize</span>
<a name="line-193"></a>
<a name="line-194"></a><a name="getInitialWindowSize"></a><span class='hs-definition'>getInitialWindowSize</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>IO</span> <span class='hs-conid'>Size</span>
<a name="line-195"></a><span class='hs-definition'>getInitialWindowSize</span> <span class='hs-keyglyph'>=</span> <span class='hs-keyword'>do</span>
<a name="line-196"></a> <span class='hs-varid'>w</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>simpleGet</span> <span class='hs-varid'>fromIntegral</span> <span class='hs-varid'>glut_INIT_WINDOW_WIDTH</span>
<a name="line-197"></a> <span class='hs-varid'>h</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>simpleGet</span> <span class='hs-varid'>fromIntegral</span> <span class='hs-varid'>glut_INIT_WINDOW_HEIGHT</span>
<a name="line-198"></a> <span class='hs-varid'>return</span> <span class='hs-varop'>$</span> <span class='hs-conid'>Size</span> <span class='hs-varid'>w</span> <span class='hs-varid'>h</span>
<a name="line-199"></a>
<a name="line-200"></a><a name="setInitialWindowSize"></a><span class='hs-definition'>setInitialWindowSize</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Size</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>IO</span> <span class='hs-conid'>()</span>
<a name="line-201"></a><span class='hs-definition'>setInitialWindowSize</span> <span class='hs-layout'>(</span><span class='hs-conid'>Size</span> <span class='hs-varid'>w</span> <span class='hs-varid'>h</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>=</span>
<a name="line-202"></a> <span class='hs-varid'>glutInitWindowSize</span> <span class='hs-layout'>(</span><span class='hs-varid'>fromIntegral</span> <span class='hs-varid'>w</span><span class='hs-layout'>)</span> <span class='hs-layout'>(</span><span class='hs-varid'>fromIntegral</span> <span class='hs-varid'>h</span><span class='hs-layout'>)</span>
<a name="line-203"></a>
<a name="line-204"></a><span class='hs-comment'>--------------------------------------------------------------------------------</span>
<a name="line-205"></a>
<a name="line-206"></a><span class='hs-comment'>-- | A single aspect of a window which is to be created, used in conjunction</span>
<a name="line-207"></a><span class='hs-comment'>-- with 'initialDisplayMode'.</span>
<a name="line-208"></a>
<a name="line-209"></a><a name="DisplayMode"></a><span class='hs-keyword'>data</span> <span class='hs-conid'>DisplayMode</span>
<a name="line-210"></a> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>RGBAMode</span>
<a name="line-211"></a> <span class='hs-comment'>-- ^ Select an RGBA mode window. This is the default if neither 'RGBAMode'</span>
<a name="line-212"></a> <span class='hs-comment'>-- nor 'IndexMode' are specified.</span>
<a name="line-213"></a> <span class='hs-keyglyph'>|</span> <span class='hs-conid'>RGBMode</span>
<a name="line-214"></a> <span class='hs-comment'>-- ^ An alias for 'RGBAMode'.</span>
<a name="line-215"></a> <span class='hs-keyglyph'>|</span> <span class='hs-conid'>IndexMode</span>
<a name="line-216"></a> <span class='hs-comment'>-- ^ Select a color index mode window. This overrides 'RGBAMode' if it is</span>
<a name="line-217"></a> <span class='hs-comment'>-- also specified.</span>
<a name="line-218"></a> <span class='hs-keyglyph'>|</span> <span class='hs-conid'>LuminanceMode</span>
<a name="line-219"></a> <span class='hs-comment'>-- ^ Select a window with a \"luminance\" color model. This model provides</span>
<a name="line-220"></a> <span class='hs-comment'>-- the functionality of OpenGL\'s RGBA color model, but the green and blue</span>
<a name="line-221"></a> <span class='hs-comment'>-- components are not maintained in the frame buffer. Instead each pixel\'s</span>
<a name="line-222"></a> <span class='hs-comment'>-- red component is converted to an index between zero and</span>
<a name="line-223"></a> <span class='hs-comment'>-- 'Graphics.UI.GLUT.Colormap.numColorMapEntries' and looked up in a</span>
<a name="line-224"></a> <span class='hs-comment'>-- per-window color map to determine the color of pixels within the window.</span>
<a name="line-225"></a> <span class='hs-comment'>-- The initial colormap of 'LuminanceMode' windows is initialized to be a</span>
<a name="line-226"></a> <span class='hs-comment'>-- linear gray ramp, but can be modified with GLUT\'s colormap actions.</span>
<a name="line-227"></a> <span class='hs-comment'>-- /Implementation Notes:/ 'LuminanceMode' is not supported on most OpenGL</span>
<a name="line-228"></a> <span class='hs-comment'>-- platforms.</span>
<a name="line-229"></a> <span class='hs-keyglyph'>|</span> <span class='hs-conid'>WithAlphaComponent</span>
<a name="line-230"></a> <span class='hs-comment'>-- ^ Select a window with an alpha component to the color buffer(s).</span>
<a name="line-231"></a> <span class='hs-keyglyph'>|</span> <span class='hs-conid'>WithAccumBuffer</span>
<a name="line-232"></a> <span class='hs-comment'>-- ^ Select a window with an accumulation buffer.</span>
<a name="line-233"></a> <span class='hs-keyglyph'>|</span> <span class='hs-conid'>WithDepthBuffer</span>
<a name="line-234"></a> <span class='hs-comment'>-- ^ Select a window with a depth buffer.</span>
<a name="line-235"></a> <span class='hs-keyglyph'>|</span> <span class='hs-conid'>WithStencilBuffer</span>
<a name="line-236"></a> <span class='hs-comment'>-- ^ Select a window with a stencil buffer.</span>
<a name="line-237"></a> <span class='hs-keyglyph'>|</span> <span class='hs-conid'>WithAuxBuffers</span> <span class='hs-conid'>Int</span>
<a name="line-238"></a> <span class='hs-comment'>-- ^ (/freeglut only/) Select a window with /n/ (1 .. 4) auxiliary buffers.</span>
<a name="line-239"></a> <span class='hs-comment'>-- Any /n/ outside the range 1 .. 4 is a fatal error.</span>
<a name="line-240"></a> <span class='hs-keyglyph'>|</span> <span class='hs-conid'>SingleBuffered</span>
<a name="line-241"></a> <span class='hs-comment'>-- ^ Select a single buffered window. This is the default if neither</span>
<a name="line-242"></a> <span class='hs-comment'>-- 'DoubleBuffered' nor 'SingleBuffered' are specified.</span>
<a name="line-243"></a> <span class='hs-keyglyph'>|</span> <span class='hs-conid'>DoubleBuffered</span>
<a name="line-244"></a> <span class='hs-comment'>-- ^ Select a double buffered window. This overrides 'SingleBuffered' if it</span>
<a name="line-245"></a> <span class='hs-comment'>-- is also specified.</span>
<a name="line-246"></a> <span class='hs-keyglyph'>|</span> <span class='hs-conid'>Multisampling</span>
<a name="line-247"></a> <span class='hs-comment'>-- ^ Select a window with multisampling support. If multisampling is not</span>
<a name="line-248"></a> <span class='hs-comment'>-- available, a non-multisampling window will automatically be chosen.</span>
<a name="line-249"></a> <span class='hs-comment'>-- Note: both the OpenGL client-side and server-side implementations must</span>
<a name="line-250"></a> <span class='hs-comment'>-- support the @GLX_SAMPLE_SGIS@ extension for multisampling to be</span>
<a name="line-251"></a> <span class='hs-comment'>-- available. Deprecated, use 'WithSamplesPerPixel'.</span>
<a name="line-252"></a> <span class='hs-keyglyph'>|</span> <span class='hs-conid'>WithSamplesPerPixel</span> <span class='hs-conid'>Int</span>
<a name="line-253"></a> <span class='hs-comment'>-- ^ Select a window with multisampling, using the given samples per pixel.</span>
<a name="line-254"></a> <span class='hs-keyglyph'>|</span> <span class='hs-conid'>Stereoscopic</span>
<a name="line-255"></a> <span class='hs-comment'>-- ^ Select a stereo window.</span>
<a name="line-256"></a> <span class='hs-keyglyph'>|</span> <span class='hs-conid'>Captionless</span>
<a name="line-257"></a> <span class='hs-comment'>-- ^ Select a window without a caption (/freeglut only/).</span>
<a name="line-258"></a> <span class='hs-keyglyph'>|</span> <span class='hs-conid'>Borderless</span>
<a name="line-259"></a> <span class='hs-comment'>-- ^ Select a window without any borders (/freeglut only/).</span>
<a name="line-260"></a> <span class='hs-keyglyph'>|</span> <span class='hs-conid'>SRGBMode</span>
<a name="line-261"></a> <span class='hs-comment'>-- ^ Select an sRGB mode window (/freeglut only/).</span>
<a name="line-262"></a> <span class='hs-keyword'>deriving</span> <span class='hs-layout'>(</span> <span class='hs-conid'>Eq</span><span class='hs-layout'>,</span> <span class='hs-conid'>Ord</span><span class='hs-layout'>,</span> <span class='hs-conid'>Show</span> <span class='hs-layout'>)</span>
<a name="line-263"></a>
<a name="line-264"></a><a name="marshalDisplayMode"></a><span class='hs-definition'>marshalDisplayMode</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>DisplayMode</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>CUInt</span>
<a name="line-265"></a><span class='hs-definition'>marshalDisplayMode</span> <span class='hs-varid'>m</span> <span class='hs-keyglyph'>=</span> <span class='hs-keyword'>case</span> <span class='hs-varid'>m</span> <span class='hs-keyword'>of</span>
<a name="line-266"></a> <span class='hs-conid'>RGBAMode</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>glut_RGBA</span>
<a name="line-267"></a> <span class='hs-conid'>RGBMode</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>glut_RGB</span>
<a name="line-268"></a> <span class='hs-conid'>IndexMode</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>glut_INDEX</span>
<a name="line-269"></a> <span class='hs-conid'>LuminanceMode</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>glut_LUMINANCE</span>
<a name="line-270"></a> <span class='hs-conid'>WithAlphaComponent</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>glut_ALPHA</span>
<a name="line-271"></a> <span class='hs-conid'>WithAccumBuffer</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>glut_ACCUM</span>
<a name="line-272"></a> <span class='hs-conid'>WithDepthBuffer</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>glut_DEPTH</span>
<a name="line-273"></a> <span class='hs-conid'>WithStencilBuffer</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>glut_STENCIL</span>
<a name="line-274"></a> <span class='hs-conid'>WithAuxBuffers</span> <span class='hs-num'>1</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>glut_AUX1</span>
<a name="line-275"></a> <span class='hs-conid'>WithAuxBuffers</span> <span class='hs-num'>2</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>glut_AUX2</span>
<a name="line-276"></a> <span class='hs-conid'>WithAuxBuffers</span> <span class='hs-num'>3</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>glut_AUX3</span>
<a name="line-277"></a> <span class='hs-conid'>WithAuxBuffers</span> <span class='hs-num'>4</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>glut_AUX4</span>
<a name="line-278"></a> <span class='hs-conid'>WithAuxBuffers</span> <span class='hs-varid'>n</span> <span class='hs-keyglyph'>-></span>
<a name="line-279"></a> <span class='hs-varid'>error</span> <span class='hs-layout'>(</span><span class='hs-str'>"marshalDisplayMode: illegal number of auxiliary buffers: "</span> <span class='hs-varop'>++</span> <span class='hs-varid'>show</span> <span class='hs-varid'>n</span><span class='hs-layout'>)</span>
<a name="line-280"></a> <span class='hs-conid'>SingleBuffered</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>glut_SINGLE</span>
<a name="line-281"></a> <span class='hs-conid'>DoubleBuffered</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>glut_DOUBLE</span>
<a name="line-282"></a> <span class='hs-conid'>Multisampling</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>glut_MULTISAMPLE</span>
<a name="line-283"></a> <span class='hs-conid'>WithSamplesPerPixel</span> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>error</span> <span class='hs-layout'>(</span><span class='hs-str'>"marshalDisplayMode: this should not happen"</span><span class='hs-layout'>)</span>
<a name="line-284"></a> <span class='hs-conid'>Stereoscopic</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>glut_STEREO</span>
<a name="line-285"></a> <span class='hs-conid'>Captionless</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>glut_CAPTIONLESS</span>
<a name="line-286"></a> <span class='hs-conid'>Borderless</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>glut_BORDERLESS</span>
<a name="line-287"></a> <span class='hs-conid'>SRGBMode</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>glut_SRGB</span>
<a name="line-288"></a>
<a name="line-289"></a><span class='hs-comment'>--------------------------------------------------------------------------------</span>
<a name="line-290"></a>
<a name="line-291"></a><span class='hs-comment'>-- | Controls the /initial display mode/ used when creating top-level windows,</span>
<a name="line-292"></a><span class='hs-comment'>-- subwindows, and overlays to determine the OpenGL display mode for the</span>
<a name="line-293"></a><span class='hs-comment'>-- to-be-created window or overlay.</span>
<a name="line-294"></a><span class='hs-comment'>--</span>
<a name="line-295"></a><span class='hs-comment'>-- Note that 'RGBAMode' selects the RGBA color model, but it does not request any</span>
<a name="line-296"></a><span class='hs-comment'>-- bits of alpha (sometimes called an /alpha buffer/ or /destination alpha/)</span>
<a name="line-297"></a><span class='hs-comment'>-- be allocated. To request alpha, specify 'WithAlphaComponent'. The same</span>
<a name="line-298"></a><span class='hs-comment'>-- applies to 'LuminanceMode'.</span>
<a name="line-299"></a>
<a name="line-300"></a><a name="initialDisplayMode"></a><span class='hs-definition'>initialDisplayMode</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>StateVar</span> <span class='hs-keyglyph'>[</span><span class='hs-conid'>DisplayMode</span><span class='hs-keyglyph'>]</span>
<a name="line-301"></a><span class='hs-definition'>initialDisplayMode</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>makeStateVar</span> <span class='hs-varid'>getInitialDisplayMode</span> <span class='hs-varid'>setInitialDisplayMode</span>
<a name="line-302"></a>
<a name="line-303"></a><a name="getInitialDisplayMode"></a><span class='hs-definition'>getInitialDisplayMode</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>IO</span> <span class='hs-keyglyph'>[</span><span class='hs-conid'>DisplayMode</span><span class='hs-keyglyph'>]</span>
<a name="line-304"></a><span class='hs-definition'>getInitialDisplayMode</span> <span class='hs-keyglyph'>=</span> <span class='hs-keyword'>do</span>
<a name="line-305"></a> <span class='hs-varid'>mode</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>simpleGet</span> <span class='hs-varid'>fromIntegral</span> <span class='hs-varid'>glut_INIT_DISPLAY_MODE</span>
<a name="line-306"></a> <span class='hs-keyword'>let</span> <span class='hs-varid'>displayModes</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>i2dms</span> <span class='hs-layout'>(</span><span class='hs-varid'>mode</span> <span class='hs-varop'>.&.</span> <span class='hs-varid'>complement</span> <span class='hs-varid'>glut_MULTISAMPLE</span><span class='hs-layout'>)</span>
<a name="line-307"></a> <span class='hs-keyword'>if</span> <span class='hs-varid'>mode</span> <span class='hs-varop'>.&.</span> <span class='hs-varid'>glut_MULTISAMPLE</span> <span class='hs-varop'>==</span> <span class='hs-num'>0</span>
<a name="line-308"></a> <span class='hs-keyword'>then</span> <span class='hs-varid'>return</span> <span class='hs-varid'>displayModes</span>
<a name="line-309"></a> <span class='hs-keyword'>else</span> <span class='hs-keyword'>do</span>
<a name="line-310"></a> <span class='hs-varid'>n</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>get</span> <span class='hs-varid'>samplesPerPixel</span>
<a name="line-311"></a> <span class='hs-varid'>return</span> <span class='hs-varop'>$</span> <span class='hs-conid'>WithSamplesPerPixel</span> <span class='hs-varid'>n</span> <span class='hs-conop'>:</span> <span class='hs-varid'>displayModes</span>
<a name="line-312"></a>
<a name="line-313"></a><a name="i2dms"></a><span class='hs-definition'>i2dms</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>CUInt</span> <span class='hs-keyglyph'>-></span> <span class='hs-keyglyph'>[</span><span class='hs-conid'>DisplayMode</span><span class='hs-keyglyph'>]</span>
<a name="line-314"></a><span class='hs-definition'>i2dms</span> <span class='hs-varid'>bitfield</span> <span class='hs-keyglyph'>|</span> <span class='hs-conid'>IndexMode</span> <span class='hs-varop'>`elem`</span> <span class='hs-varid'>modes</span> <span class='hs-varop'>||</span> <span class='hs-conid'>LuminanceMode</span> <span class='hs-varop'>`elem`</span> <span class='hs-varid'>modes</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>modes</span>
<a name="line-315"></a> <span class='hs-keyglyph'>|</span> <span class='hs-varid'>otherwise</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>RGBAMode</span> <span class='hs-conop'>:</span> <span class='hs-varid'>modes</span>
<a name="line-316"></a> <span class='hs-keyword'>where</span> <span class='hs-varid'>modes</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>i2dmsWithoutRGBA</span> <span class='hs-varid'>bitfield</span>
<a name="line-317"></a>
<a name="line-318"></a><a name="i2dmsWithoutRGBA"></a><span class='hs-definition'>i2dmsWithoutRGBA</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>CUInt</span> <span class='hs-keyglyph'>-></span> <span class='hs-keyglyph'>[</span><span class='hs-conid'>DisplayMode</span><span class='hs-keyglyph'>]</span>
<a name="line-319"></a><span class='hs-definition'>i2dmsWithoutRGBA</span> <span class='hs-varid'>bitfield</span> <span class='hs-keyglyph'>=</span>
<a name="line-320"></a> <span class='hs-keyglyph'>[</span> <span class='hs-varid'>c</span> <span class='hs-keyglyph'>|</span> <span class='hs-varid'>c</span> <span class='hs-keyglyph'><-</span> <span class='hs-keyglyph'>[</span> <span class='hs-conid'>IndexMode</span><span class='hs-layout'>,</span> <span class='hs-conid'>LuminanceMode</span><span class='hs-layout'>,</span> <span class='hs-conid'>WithAlphaComponent</span><span class='hs-layout'>,</span>
<a name="line-321"></a> <span class='hs-conid'>WithAccumBuffer</span><span class='hs-layout'>,</span> <span class='hs-conid'>WithDepthBuffer</span><span class='hs-layout'>,</span> <span class='hs-conid'>WithStencilBuffer</span><span class='hs-layout'>,</span>
<a name="line-322"></a> <span class='hs-conid'>WithAuxBuffers</span> <span class='hs-num'>1</span><span class='hs-layout'>,</span> <span class='hs-conid'>WithAuxBuffers</span> <span class='hs-num'>2</span><span class='hs-layout'>,</span> <span class='hs-conid'>WithAuxBuffers</span> <span class='hs-num'>3</span><span class='hs-layout'>,</span>
<a name="line-323"></a> <span class='hs-conid'>WithAuxBuffers</span> <span class='hs-num'>4</span><span class='hs-layout'>,</span> <span class='hs-conid'>SingleBuffered</span><span class='hs-layout'>,</span> <span class='hs-conid'>DoubleBuffered</span><span class='hs-layout'>,</span> <span class='hs-conid'>Multisampling</span><span class='hs-layout'>,</span>
<a name="line-324"></a> <span class='hs-conid'>Stereoscopic</span><span class='hs-layout'>,</span> <span class='hs-conid'>Captionless</span><span class='hs-layout'>,</span> <span class='hs-conid'>Borderless</span><span class='hs-layout'>,</span> <span class='hs-conid'>SRGBMode</span> <span class='hs-keyglyph'>]</span>
<a name="line-325"></a> <span class='hs-layout'>,</span> <span class='hs-layout'>(</span><span class='hs-varid'>bitfield</span> <span class='hs-varop'>.&.</span> <span class='hs-varid'>marshalDisplayMode</span> <span class='hs-varid'>c</span><span class='hs-layout'>)</span> <span class='hs-varop'>/=</span> <span class='hs-num'>0</span> <span class='hs-keyglyph'>]</span>
<a name="line-326"></a>
<a name="line-327"></a><a name="setInitialDisplayMode"></a><span class='hs-definition'>setInitialDisplayMode</span> <span class='hs-keyglyph'>::</span> <span class='hs-keyglyph'>[</span><span class='hs-conid'>DisplayMode</span><span class='hs-keyglyph'>]</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>IO</span> <span class='hs-conid'>()</span>
<a name="line-328"></a><span class='hs-definition'>setInitialDisplayMode</span> <span class='hs-varid'>modes</span> <span class='hs-keyglyph'>=</span> <span class='hs-keyword'>do</span>
<a name="line-329"></a> <span class='hs-keyword'>let</span> <span class='hs-layout'>(</span><span class='hs-varid'>spps</span><span class='hs-layout'>,</span> <span class='hs-varid'>transformedModes</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>mapAccumR</span> <span class='hs-varid'>handleMultisampling</span> <span class='hs-conid'>[]</span> <span class='hs-varid'>modes</span>
<a name="line-330"></a> <span class='hs-varid'>mapM_</span> <span class='hs-layout'>(</span><span class='hs-varid'>samplesPerPixel</span> <span class='hs-varop'>$=</span><span class='hs-layout'>)</span> <span class='hs-varid'>spps</span>
<a name="line-331"></a> <span class='hs-varid'>glutInitDisplayMode</span> <span class='hs-layout'>(</span><span class='hs-varid'>toBitfield</span> <span class='hs-varid'>marshalDisplayMode</span> <span class='hs-varid'>transformedModes</span><span class='hs-layout'>)</span>
<a name="line-332"></a>
<a name="line-333"></a><a name="handleMultisampling"></a><span class='hs-definition'>handleMultisampling</span> <span class='hs-keyglyph'>::</span> <span class='hs-keyglyph'>[</span><span class='hs-conid'>Int</span><span class='hs-keyglyph'>]</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>DisplayMode</span> <span class='hs-keyglyph'>-></span> <span class='hs-layout'>(</span><span class='hs-keyglyph'>[</span><span class='hs-conid'>Int</span><span class='hs-keyglyph'>]</span><span class='hs-layout'>,</span> <span class='hs-conid'>DisplayMode</span><span class='hs-layout'>)</span>
<a name="line-334"></a><span class='hs-definition'>handleMultisampling</span> <span class='hs-varid'>spps</span> <span class='hs-layout'>(</span><span class='hs-conid'>WithSamplesPerPixel</span> <span class='hs-varid'>spp</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>=</span> <span class='hs-layout'>(</span><span class='hs-varid'>spp</span> <span class='hs-conop'>:</span> <span class='hs-varid'>spps</span><span class='hs-layout'>,</span> <span class='hs-conid'>Multisampling</span><span class='hs-layout'>)</span>
<a name="line-335"></a><span class='hs-definition'>handleMultisampling</span> <span class='hs-varid'>spps</span> <span class='hs-varid'>mode</span> <span class='hs-keyglyph'>=</span> <span class='hs-layout'>(</span><span class='hs-varid'>spps</span><span class='hs-layout'>,</span> <span class='hs-varid'>mode</span><span class='hs-layout'>)</span>
<a name="line-336"></a>
<a name="line-337"></a><a name="toBitfield"></a><span class='hs-definition'>toBitfield</span> <span class='hs-keyglyph'>::</span> <span class='hs-layout'>(</span><span class='hs-conid'>Num</span> <span class='hs-varid'>b</span><span class='hs-layout'>,</span> <span class='hs-conid'>Bits</span> <span class='hs-varid'>b</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>=></span> <span class='hs-layout'>(</span><span class='hs-varid'>a</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>b</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-></span> <span class='hs-keyglyph'>[</span><span class='hs-varid'>a</span><span class='hs-keyglyph'>]</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>b</span>
<a name="line-338"></a><span class='hs-definition'>toBitfield</span> <span class='hs-varid'>marshal</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>foldl</span> <span class='hs-layout'>(</span><span class='hs-varop'>.|.</span><span class='hs-layout'>)</span> <span class='hs-num'>0</span> <span class='hs-varop'>.</span> <span class='hs-varid'>map</span> <span class='hs-varid'>marshal</span>
<a name="line-339"></a>
<a name="line-340"></a><span class='hs-comment'>-- | Contains 'True' if the /current display mode/ is supported, 'False'</span>
<a name="line-341"></a><span class='hs-comment'>-- otherwise.</span>
<a name="line-342"></a>
<a name="line-343"></a><a name="displayModePossible"></a><span class='hs-definition'>displayModePossible</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>GettableStateVar</span> <span class='hs-conid'>Bool</span>
<a name="line-344"></a><span class='hs-definition'>displayModePossible</span> <span class='hs-keyglyph'>=</span>
<a name="line-345"></a> <span class='hs-varid'>makeGettableStateVar</span> <span class='hs-varop'>$</span> <span class='hs-varid'>simpleGet</span> <span class='hs-layout'>(</span><span class='hs-varop'>/=</span> <span class='hs-num'>0</span><span class='hs-layout'>)</span> <span class='hs-varid'>glut_DISPLAY_MODE_POSSIBLE</span>
<a name="line-346"></a>
<a name="line-347"></a><span class='hs-comment'>--------------------------------------------------------------------------------</span>
<a name="line-348"></a>
<a name="line-349"></a><a name="samplesPerPixel"></a><span class='hs-definition'>samplesPerPixel</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>StateVar</span> <span class='hs-conid'>Int</span>
<a name="line-350"></a><span class='hs-definition'>samplesPerPixel</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>makeStateVar</span> <span class='hs-varid'>getSamplesPerPixel</span> <span class='hs-varid'>setSamplesPerPixel</span>
<a name="line-351"></a>
<a name="line-352"></a><a name="getSamplesPerPixel"></a><span class='hs-definition'>getSamplesPerPixel</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>IO</span> <span class='hs-conid'>Int</span>
<a name="line-353"></a><span class='hs-definition'>getSamplesPerPixel</span> <span class='hs-keyglyph'>=</span> <span class='hs-keyword'>do</span>
<a name="line-354"></a> <span class='hs-varid'>m</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>multisamplingSupported</span>
<a name="line-355"></a> <span class='hs-keyword'>if</span> <span class='hs-varid'>m</span>
<a name="line-356"></a> <span class='hs-keyword'>then</span> <span class='hs-varid'>simpleGet</span> <span class='hs-varid'>fromIntegral</span> <span class='hs-layout'>(</span><span class='hs-varid'>fromIntegral</span> <span class='hs-varid'>glut_MULTISAMPLE</span><span class='hs-layout'>)</span>
<a name="line-357"></a> <span class='hs-keyword'>else</span> <span class='hs-varid'>return</span> <span class='hs-varid'>defaultSamplesPerPixels</span>
<a name="line-358"></a>
<a name="line-359"></a><a name="defaultSamplesPerPixels"></a><span class='hs-definition'>defaultSamplesPerPixels</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Int</span>
<a name="line-360"></a><span class='hs-definition'>defaultSamplesPerPixels</span> <span class='hs-keyglyph'>=</span> <span class='hs-num'>4</span>
<a name="line-361"></a>
<a name="line-362"></a><a name="setSamplesPerPixel"></a><span class='hs-definition'>setSamplesPerPixel</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Int</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>IO</span> <span class='hs-conid'>()</span>
<a name="line-363"></a><span class='hs-definition'>setSamplesPerPixel</span> <span class='hs-varid'>spp</span> <span class='hs-keyglyph'>=</span> <span class='hs-keyword'>do</span>
<a name="line-364"></a> <span class='hs-varid'>m</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>multisamplingSupported</span>
<a name="line-365"></a> <span class='hs-varid'>when</span> <span class='hs-varid'>m</span> <span class='hs-varop'>$</span>
<a name="line-366"></a> <span class='hs-varid'>glutSetOption</span> <span class='hs-layout'>(</span><span class='hs-varid'>fromIntegral</span> <span class='hs-varid'>glut_MULTISAMPLE</span><span class='hs-layout'>)</span> <span class='hs-layout'>(</span><span class='hs-varid'>fromIntegral</span> <span class='hs-varid'>spp</span><span class='hs-layout'>)</span>
<a name="line-367"></a>
<a name="line-368"></a><a name="multisamplingSupported"></a><span class='hs-definition'>multisamplingSupported</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>IO</span> <span class='hs-conid'>Bool</span>
<a name="line-369"></a><span class='hs-definition'>multisamplingSupported</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>isKnown</span> <span class='hs-str'>"glutGetModeValues"</span>
<a name="line-370"></a> <span class='hs-keyword'>where</span> <span class='hs-varid'>isKnown</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>fmap</span> <span class='hs-layout'>(</span><span class='hs-varop'>/=</span> <span class='hs-varid'>nullFunPtr</span><span class='hs-layout'>)</span> <span class='hs-varop'>.</span> <span class='hs-varid'>getAPIEntryInternal</span>
<a name="line-371"></a>
<a name="line-372"></a><span class='hs-comment'>--------------------------------------------------------------------------------</span>
<a name="line-373"></a>
<a name="line-374"></a><span class='hs-comment'>-- | Capabilities for 'initialDisplayCapabilities', most of them are extensions</span>
<a name="line-375"></a><span class='hs-comment'>-- of the constructors of 'DisplayMode'.</span>
<a name="line-376"></a>
<a name="line-377"></a><a name="DisplayCapability"></a><span class='hs-keyword'>data</span> <span class='hs-conid'>DisplayCapability</span>
<a name="line-378"></a> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>DisplayRGBA</span> <span class='hs-comment'>-- ^ Number of bits of red, green, blue, and alpha in the RGBA</span>
<a name="line-379"></a> <span class='hs-comment'>-- color buffer. Default is \"'IsAtLeast' @1@\" for red,</span>
<a name="line-380"></a> <span class='hs-comment'>-- green, blue, and alpha capabilities, and \"'IsEqualTo'</span>
<a name="line-381"></a> <span class='hs-comment'>-- @1@\" for the RGBA color model capability.</span>
<a name="line-382"></a> <span class='hs-keyglyph'>|</span> <span class='hs-conid'>DisplayRGB</span> <span class='hs-comment'>-- ^ Number of bits of red, green, and blue in the RGBA color</span>
<a name="line-383"></a> <span class='hs-comment'>-- buffer and zero bits of alpha color buffer precision.</span>
<a name="line-384"></a> <span class='hs-comment'>-- Default is \"'IsAtLeast' @1@\" for the red, green, and</span>
<a name="line-385"></a> <span class='hs-comment'>-- blue capabilities, and \"'IsNotLessThan' @0@\" for alpha</span>
<a name="line-386"></a> <span class='hs-comment'>-- capability, and \"'IsEqualTo' @1@\" for the RGBA color</span>
<a name="line-387"></a> <span class='hs-comment'>-- model capability.</span>
<a name="line-388"></a> <span class='hs-keyglyph'>|</span> <span class='hs-conid'>DisplayRed</span> <span class='hs-comment'>-- ^ Red color buffer precision in bits. Default is</span>
<a name="line-389"></a> <span class='hs-comment'>-- \"'IsAtLeast' @1@\".</span>
<a name="line-390"></a> <span class='hs-keyglyph'>|</span> <span class='hs-conid'>DisplayGreen</span> <span class='hs-comment'>-- ^ Green color buffer precision in bits. Default is</span>
<a name="line-391"></a> <span class='hs-comment'>-- \"'IsAtLeast' @1@\".</span>
<a name="line-392"></a> <span class='hs-keyglyph'>|</span> <span class='hs-conid'>DisplayBlue</span> <span class='hs-comment'>-- ^ Blue color buffer precision in bits. Default is</span>
<a name="line-393"></a> <span class='hs-comment'>-- \"'IsAtLeast' @1@\".</span>
<a name="line-394"></a> <span class='hs-keyglyph'>|</span> <span class='hs-conid'>DisplayIndex</span> <span class='hs-comment'>-- ^ Boolean if the color model is color index or not. True is</span>
<a name="line-395"></a> <span class='hs-comment'>-- color index. Default is \"'IsAtLeast' @1@\".</span>
<a name="line-396"></a> <span class='hs-keyglyph'>|</span> <span class='hs-conid'>DisplayBuffer</span> <span class='hs-comment'>-- ^ Number of bits in the color index color buffer. Default</span>
<a name="line-397"></a> <span class='hs-comment'>-- is \"'IsAtLeast' @1@\".</span>
<a name="line-398"></a> <span class='hs-keyglyph'>|</span> <span class='hs-conid'>DisplaySingle</span> <span class='hs-comment'>-- ^ Boolean indicate the color buffer is single buffered.</span>
<a name="line-399"></a> <span class='hs-comment'>-- Default is \"'IsEqualTo' @1@\".</span>
<a name="line-400"></a> <span class='hs-keyglyph'>|</span> <span class='hs-conid'>DisplayDouble</span> <span class='hs-comment'>-- ^ Boolean indicating if the color buffer is double</span>
<a name="line-401"></a> <span class='hs-comment'>-- buffered. Default is \"'IsEqualTo' @1@\".</span>
<a name="line-402"></a> <span class='hs-keyglyph'>|</span> <span class='hs-conid'>DisplayAccA</span> <span class='hs-comment'>-- ^ Red, green, blue, and alpha accumulation buffer precision</span>
<a name="line-403"></a> <span class='hs-comment'>-- in bits. Default is \"'IsAtLeast' @1@\" for red, green,</span>
<a name="line-404"></a> <span class='hs-comment'>-- blue, and alpha capabilities.</span>
<a name="line-405"></a> <span class='hs-keyglyph'>|</span> <span class='hs-conid'>DisplayAcc</span> <span class='hs-comment'>-- ^ Red, green, and green accumulation buffer precision in</span>
<a name="line-406"></a> <span class='hs-comment'>-- bits and zero bits of alpha accumulation buffer precision.</span>
<a name="line-407"></a> <span class='hs-comment'>-- Default is \"'IsAtLeast' @1@\" for red, green, and blue</span>
<a name="line-408"></a> <span class='hs-comment'>-- capabilities, and \"'IsNotLessThan' @0@\" for the alpha</span>
<a name="line-409"></a> <span class='hs-comment'>-- capability.</span>
<a name="line-410"></a> <span class='hs-keyglyph'>|</span> <span class='hs-conid'>DisplayAlpha</span> <span class='hs-comment'>-- ^ Alpha color buffer precision in bits. Default is</span>
<a name="line-411"></a> <span class='hs-comment'>-- \"'IsAtLeast' @1@\".</span>
<a name="line-412"></a> <span class='hs-keyglyph'>|</span> <span class='hs-conid'>DisplayDepth</span> <span class='hs-comment'>-- ^ Number of bits of precsion in the depth buffer. Default</span>
<a name="line-413"></a> <span class='hs-comment'>-- is \"'IsAtLeast' @12@\".</span>
<a name="line-414"></a> <span class='hs-keyglyph'>|</span> <span class='hs-conid'>DisplayStencil</span> <span class='hs-comment'>-- ^ Number of bits in the stencil buffer. Default is</span>
<a name="line-415"></a> <span class='hs-comment'>-- \"'IsNotLessThan' @1@\".</span>
<a name="line-416"></a> <span class='hs-keyglyph'>|</span> <span class='hs-conid'>DisplaySamples</span> <span class='hs-comment'>-- ^ Indicates the number of multisamples to use based on</span>
<a name="line-417"></a> <span class='hs-comment'>-- GLX\'s @SGIS_multisample@ extension (for antialiasing).</span>
<a name="line-418"></a> <span class='hs-comment'>-- Default is \"'IsNotGreaterThan' @4@\". This default means</span>
<a name="line-419"></a> <span class='hs-comment'>-- that a GLUT application can request multisampling if</span>
<a name="line-420"></a> <span class='hs-comment'>-- available by simply specifying \"'With' 'DisplaySamples'\".</span>
<a name="line-421"></a> <span class='hs-keyglyph'>|</span> <span class='hs-conid'>DisplayStereo</span> <span class='hs-comment'>-- ^ Boolean indicating the color buffer is supports</span>
<a name="line-422"></a> <span class='hs-comment'>-- OpenGL-style stereo. Default is \"'IsEqualTo' @1@\".</span>
<a name="line-423"></a> <span class='hs-keyglyph'>|</span> <span class='hs-conid'>DisplayLuminance</span> <span class='hs-comment'>-- ^ Number of bits of red in the RGBA and zero bits of green,</span>
<a name="line-424"></a> <span class='hs-comment'>-- blue (alpha not specified) of color buffer precision.</span>
<a name="line-425"></a> <span class='hs-comment'>-- Default is \"'IsAtLeast' @1@\" for the red capabilitis,</span>
<a name="line-426"></a> <span class='hs-comment'>-- and \"'IsEqualTo' @0@\" for the green and blue</span>
<a name="line-427"></a> <span class='hs-comment'>-- capabilities, and \"'IsEqualTo' @1@\" for the RGBA color</span>
<a name="line-428"></a> <span class='hs-comment'>-- model capability, and, for X11, \"'IsEqualTo' @1@\" for</span>
<a name="line-429"></a> <span class='hs-comment'>-- the 'DisplayXStaticGray' capability. SGI InfiniteReality (and</span>
<a name="line-430"></a> <span class='hs-comment'>-- other future machines) support a 16-bit luminance (single</span>
<a name="line-431"></a> <span class='hs-comment'>-- channel) display mode (an additional 16-bit alpha channel</span>
<a name="line-432"></a> <span class='hs-comment'>-- can also be requested). The red channel maps to gray</span>
<a name="line-433"></a> <span class='hs-comment'>-- scale and green and blue channels are not available. A</span>
<a name="line-434"></a> <span class='hs-comment'>-- 16-bit precision luminance display mode is often</span>
<a name="line-435"></a> <span class='hs-comment'>-- appropriate for medical imaging applications. Do not</span>
<a name="line-436"></a> <span class='hs-comment'>-- expect many machines to support extended precision</span>
<a name="line-437"></a> <span class='hs-comment'>-- luminance display modes.</span>
<a name="line-438"></a> <span class='hs-keyglyph'>|</span> <span class='hs-conid'>DisplayAux</span> <span class='hs-comment'>-- ^ (/freeglut only/) Number of auxiliary buffers. Default is</span>
<a name="line-439"></a> <span class='hs-comment'>-- \"'IsEqualTo' @1@\".</span>
<a name="line-440"></a> <span class='hs-keyglyph'>|</span> <span class='hs-conid'>DisplayNum</span> <span class='hs-comment'>-- ^ A special capability name indicating where the value</span>
<a name="line-441"></a> <span class='hs-comment'>-- represents the Nth frame buffer configuration matching</span>
<a name="line-442"></a> <span class='hs-comment'>-- the description string. When not specified,</span>
<a name="line-443"></a> <span class='hs-comment'>-- 'initialDisplayCapabilities' also uses the first</span>
<a name="line-444"></a> <span class='hs-comment'>-- (best matching) configuration. 'Num' requires a relation</span>
<a name="line-445"></a> <span class='hs-comment'>-- and numeric value.</span>
<a name="line-446"></a> <span class='hs-keyglyph'>|</span> <span class='hs-conid'>DisplayConformant</span> <span class='hs-comment'>-- ^ Boolean indicating if the frame buffer configuration is</span>
<a name="line-447"></a> <span class='hs-comment'>-- conformant or not. Conformance information is based on</span>
<a name="line-448"></a> <span class='hs-comment'>-- GLX\'s @EXT_visual_rating@ extension if supported. If the</span>
<a name="line-449"></a> <span class='hs-comment'>-- extension is not supported, all visuals are assumed</span>
<a name="line-450"></a> <span class='hs-comment'>-- conformant. Default is \"'IsEqualTo' @1@\".</span>
<a name="line-451"></a> <span class='hs-keyglyph'>|</span> <span class='hs-conid'>DisplaySlow</span> <span class='hs-comment'>-- ^ Boolean indicating if the frame buffer configuration is</span>
<a name="line-452"></a> <span class='hs-comment'>-- slow or not. Slowness information is based on GLX\'s</span>
<a name="line-453"></a> <span class='hs-comment'>-- @EXT_visual_rating@ extension if supported. If the</span>
<a name="line-454"></a> <span class='hs-comment'>-- extension is not supported, all visuals are assumed fast.</span>
<a name="line-455"></a> <span class='hs-comment'>-- Note that slowness is a relative designation relative to</span>
<a name="line-456"></a> <span class='hs-comment'>-- other frame buffer configurations available. The intent</span>
<a name="line-457"></a> <span class='hs-comment'>-- of the slow capability is to help programs avoid frame</span>
<a name="line-458"></a> <span class='hs-comment'>-- buffer configurations that are slower (but perhaps higher</span>
<a name="line-459"></a> <span class='hs-comment'>-- precision) for the current machine. Default is</span>
<a name="line-460"></a> <span class='hs-comment'>-- \"'IsAtLeast' @0@\". This default means that slow visuals</span>
<a name="line-461"></a> <span class='hs-comment'>-- are used in preference to fast visuals, but fast visuals</span>
<a name="line-462"></a> <span class='hs-comment'>-- will still be allowed.</span>
<a name="line-463"></a> <span class='hs-keyglyph'>|</span> <span class='hs-conid'>DisplayWin32PFD</span> <span class='hs-comment'>-- ^ Only recognized on GLUT implementations for Win32, this</span>
<a name="line-464"></a> <span class='hs-comment'>-- capability name matches the Win32 Pixel Format Descriptor</span>
<a name="line-465"></a> <span class='hs-comment'>-- by number. 'DisplayWin32PFD' can only be used with 'Where'.</span>
<a name="line-466"></a> <span class='hs-keyglyph'>|</span> <span class='hs-conid'>DisplayXVisual</span> <span class='hs-comment'>-- ^ Only recongized on GLUT implementations for the X Window</span>
<a name="line-467"></a> <span class='hs-comment'>-- System, this capability name matches the X visual ID by</span>
<a name="line-468"></a> <span class='hs-comment'>-- number. 'DisplayXVisual' requires a relation and numeric value.</span>
<a name="line-469"></a> <span class='hs-keyglyph'>|</span> <span class='hs-conid'>DisplayXStaticGray</span> <span class='hs-comment'>-- ^ Only recongized on GLUT implementations for the X Window</span>
<a name="line-470"></a> <span class='hs-comment'>-- System, boolean indicating if the frame buffer</span>
<a name="line-471"></a> <span class='hs-comment'>-- configuration\'s X visual is of type @StaticGray@.</span>
<a name="line-472"></a> <span class='hs-comment'>-- Default is \"'IsEqualTo' @1@\".</span>
<a name="line-473"></a> <span class='hs-keyglyph'>|</span> <span class='hs-conid'>DisplayXGrayScale</span> <span class='hs-comment'>-- ^ Only recongized on GLUT implementations for the X Window</span>
<a name="line-474"></a> <span class='hs-comment'>-- System, boolean indicating if the frame buffer</span>
<a name="line-475"></a> <span class='hs-comment'>-- configuration\'s X visual is of type @GrayScale@. Default</span>
<a name="line-476"></a> <span class='hs-comment'>-- is \"'IsEqualTo' @1@\".</span>
<a name="line-477"></a> <span class='hs-keyglyph'>|</span> <span class='hs-conid'>DisplayXStaticColor</span> <span class='hs-comment'>-- ^ Only recongized on GLUT implementations for the X Window</span>
<a name="line-478"></a> <span class='hs-comment'>-- System, boolean indicating if the frame buffer</span>
<a name="line-479"></a> <span class='hs-comment'>-- configuration\'s X visual is of type @StaticColor@.</span>
<a name="line-480"></a> <span class='hs-comment'>-- Default is \"'IsEqualTo' @1@\".</span>
<a name="line-481"></a> <span class='hs-keyglyph'>|</span> <span class='hs-conid'>DisplayXPseudoColor</span> <span class='hs-comment'>-- ^ Only recongized on GLUT implementations for the X Window</span>
<a name="line-482"></a> <span class='hs-comment'>-- System, boolean indicating if the frame buffer</span>
<a name="line-483"></a> <span class='hs-comment'>-- configuration\'s X visual is of type @PsuedoColor@.</span>
<a name="line-484"></a> <span class='hs-comment'>-- Default is \"'IsEqualTo' @1@\".</span>
<a name="line-485"></a> <span class='hs-keyglyph'>|</span> <span class='hs-conid'>DisplayXTrueColor</span> <span class='hs-comment'>-- ^ Only recongized on GLUT implementations for the X Window</span>
<a name="line-486"></a> <span class='hs-comment'>-- System, boolean indicating if the frame buffer</span>
<a name="line-487"></a> <span class='hs-comment'>-- configuration\'s X visual is of type @TrueColor@. Default</span>
<a name="line-488"></a> <span class='hs-comment'>-- is \"'IsEqualTo' @1@\".</span>
<a name="line-489"></a> <span class='hs-keyglyph'>|</span> <span class='hs-conid'>DisplayXDirectColor</span> <span class='hs-comment'>-- ^ Only recongized on GLUT implementations for the X Window</span>
<a name="line-490"></a> <span class='hs-comment'>-- System, boolean indicating if the frame buffer</span>
<a name="line-491"></a> <span class='hs-comment'>-- configuration\'s X visual is of type @DirectColor@.</span>
<a name="line-492"></a> <span class='hs-comment'>-- Default is \"'IsEqualTo' @1@\".</span>
<a name="line-493"></a> <span class='hs-keyword'>deriving</span> <span class='hs-layout'>(</span> <span class='hs-conid'>Eq</span><span class='hs-layout'>,</span> <span class='hs-conid'>Ord</span><span class='hs-layout'>,</span> <span class='hs-conid'>Show</span> <span class='hs-layout'>)</span>
<a name="line-494"></a>
<a name="line-495"></a><a name="displayCapabilityToString"></a><span class='hs-definition'>displayCapabilityToString</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>DisplayCapability</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>String</span>
<a name="line-496"></a><span class='hs-definition'>displayCapabilityToString</span> <span class='hs-varid'>x</span> <span class='hs-keyglyph'>=</span> <span class='hs-keyword'>case</span> <span class='hs-varid'>x</span> <span class='hs-keyword'>of</span>
<a name="line-497"></a> <span class='hs-conid'>DisplayRGBA</span> <span class='hs-keyglyph'>-></span> <span class='hs-str'>"rgba"</span>
<a name="line-498"></a> <span class='hs-conid'>DisplayRGB</span> <span class='hs-keyglyph'>-></span> <span class='hs-str'>"rgb"</span>
<a name="line-499"></a> <span class='hs-conid'>DisplayRed</span> <span class='hs-keyglyph'>-></span> <span class='hs-str'>"red"</span>
<a name="line-500"></a> <span class='hs-conid'>DisplayGreen</span> <span class='hs-keyglyph'>-></span> <span class='hs-str'>"green"</span>
<a name="line-501"></a> <span class='hs-conid'>DisplayBlue</span> <span class='hs-keyglyph'>-></span> <span class='hs-str'>"blue"</span>
<a name="line-502"></a> <span class='hs-conid'>DisplayIndex</span> <span class='hs-keyglyph'>-></span> <span class='hs-str'>"index"</span>
<a name="line-503"></a> <span class='hs-conid'>DisplayBuffer</span> <span class='hs-keyglyph'>-></span> <span class='hs-str'>"buffer"</span>
<a name="line-504"></a> <span class='hs-conid'>DisplaySingle</span> <span class='hs-keyglyph'>-></span> <span class='hs-str'>"single"</span>
<a name="line-505"></a> <span class='hs-conid'>DisplayDouble</span> <span class='hs-keyglyph'>-></span> <span class='hs-str'>"double"</span>
<a name="line-506"></a> <span class='hs-conid'>DisplayAccA</span> <span class='hs-keyglyph'>-></span> <span class='hs-str'>"acca"</span>
<a name="line-507"></a> <span class='hs-conid'>DisplayAcc</span> <span class='hs-keyglyph'>-></span> <span class='hs-str'>"acc"</span>
<a name="line-508"></a> <span class='hs-conid'>DisplayAlpha</span> <span class='hs-keyglyph'>-></span> <span class='hs-str'>"alpha"</span>
<a name="line-509"></a> <span class='hs-conid'>DisplayDepth</span> <span class='hs-keyglyph'>-></span> <span class='hs-str'>"depth"</span>
<a name="line-510"></a> <span class='hs-conid'>DisplayStencil</span> <span class='hs-keyglyph'>-></span> <span class='hs-str'>"stencil"</span>
<a name="line-511"></a> <span class='hs-conid'>DisplaySamples</span> <span class='hs-keyglyph'>-></span> <span class='hs-str'>"samples"</span>
<a name="line-512"></a> <span class='hs-conid'>DisplayStereo</span> <span class='hs-keyglyph'>-></span> <span class='hs-str'>"stereo"</span>
<a name="line-513"></a> <span class='hs-conid'>DisplayLuminance</span> <span class='hs-keyglyph'>-></span> <span class='hs-str'>"luminance"</span>
<a name="line-514"></a> <span class='hs-conid'>DisplayAux</span> <span class='hs-keyglyph'>-></span> <span class='hs-str'>"aux"</span>
<a name="line-515"></a> <span class='hs-conid'>DisplayNum</span> <span class='hs-keyglyph'>-></span> <span class='hs-str'>"num"</span>
<a name="line-516"></a> <span class='hs-conid'>DisplayConformant</span> <span class='hs-keyglyph'>-></span> <span class='hs-str'>"conformant"</span>
<a name="line-517"></a> <span class='hs-conid'>DisplaySlow</span> <span class='hs-keyglyph'>-></span> <span class='hs-str'>"slow"</span>
<a name="line-518"></a> <span class='hs-conid'>DisplayWin32PFD</span> <span class='hs-keyglyph'>-></span> <span class='hs-str'>"win32pfd"</span>
<a name="line-519"></a> <span class='hs-conid'>DisplayXVisual</span> <span class='hs-keyglyph'>-></span> <span class='hs-str'>"xvisual"</span>
<a name="line-520"></a> <span class='hs-conid'>DisplayXStaticGray</span> <span class='hs-keyglyph'>-></span> <span class='hs-str'>"xstaticgray"</span>
<a name="line-521"></a> <span class='hs-conid'>DisplayXGrayScale</span> <span class='hs-keyglyph'>-></span> <span class='hs-str'>"xgrayscale"</span>
<a name="line-522"></a> <span class='hs-conid'>DisplayXStaticColor</span> <span class='hs-keyglyph'>-></span> <span class='hs-str'>"xstaticcolor"</span>
<a name="line-523"></a> <span class='hs-conid'>DisplayXPseudoColor</span> <span class='hs-keyglyph'>-></span> <span class='hs-str'>"xpseudocolor"</span>
<a name="line-524"></a> <span class='hs-conid'>DisplayXTrueColor</span> <span class='hs-keyglyph'>-></span> <span class='hs-str'>"xtruecolor"</span>
<a name="line-525"></a> <span class='hs-conid'>DisplayXDirectColor</span> <span class='hs-keyglyph'>-></span> <span class='hs-str'>"xdirectcolor"</span>
<a name="line-526"></a>
<a name="line-527"></a><span class='hs-comment'>-- | A single capability description for 'initialDisplayCapabilities'.</span>
<a name="line-528"></a>
<a name="line-529"></a><a name="DisplayCapabilityDescription"></a><span class='hs-keyword'>data</span> <span class='hs-conid'>DisplayCapabilityDescription</span>
<a name="line-530"></a> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>Where</span> <span class='hs-conid'>DisplayCapability</span> <span class='hs-conid'>Relation</span> <span class='hs-conid'>Int</span>
<a name="line-531"></a> <span class='hs-comment'>-- ^ A description of a capability with a specific relation to a numeric</span>
<a name="line-532"></a> <span class='hs-comment'>-- value.</span>
<a name="line-533"></a> <span class='hs-keyglyph'>|</span> <span class='hs-conid'>With</span> <span class='hs-conid'>DisplayCapability</span>
<a name="line-534"></a> <span class='hs-comment'>-- ^ When the relation and numeric value are not specified, each capability</span>
<a name="line-535"></a> <span class='hs-comment'>-- has a different default, see the different constructors of</span>
<a name="line-536"></a> <span class='hs-comment'>-- 'DisplayCapability'.</span>
<a name="line-537"></a> <span class='hs-keyword'>deriving</span> <span class='hs-layout'>(</span> <span class='hs-conid'>Eq</span><span class='hs-layout'>,</span> <span class='hs-conid'>Ord</span><span class='hs-layout'>,</span> <span class='hs-conid'>Show</span> <span class='hs-layout'>)</span>
<a name="line-538"></a>
<a name="line-539"></a><a name="displayCapabilityDescriptionToString"></a><span class='hs-definition'>displayCapabilityDescriptionToString</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>DisplayCapabilityDescription</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>String</span>
<a name="line-540"></a><span class='hs-definition'>displayCapabilityDescriptionToString</span> <span class='hs-layout'>(</span><span class='hs-conid'>Where</span> <span class='hs-varid'>c</span> <span class='hs-varid'>r</span> <span class='hs-varid'>i</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>=</span>
<a name="line-541"></a> <span class='hs-varid'>displayCapabilityToString</span> <span class='hs-varid'>c</span> <span class='hs-varop'>++</span> <span class='hs-varid'>relationToString</span> <span class='hs-varid'>r</span> <span class='hs-varop'>++</span> <span class='hs-varid'>show</span> <span class='hs-varid'>i</span>
<a name="line-542"></a><span class='hs-definition'>displayCapabilityDescriptionToString</span> <span class='hs-layout'>(</span><span class='hs-conid'>With</span> <span class='hs-varid'>c</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>displayCapabilityToString</span> <span class='hs-varid'>c</span>
<a name="line-543"></a>
<a name="line-544"></a><span class='hs-comment'>-- | Controls the /initial display mode/ used when creating top-level windows,</span>
<a name="line-545"></a><span class='hs-comment'>-- subwindows, and overlays to determine the OpenGL display mode for the</span>
<a name="line-546"></a><span class='hs-comment'>-- to-be-created window or overlay. It is described by a list of zero or more</span>
<a name="line-547"></a><span class='hs-comment'>-- capability descriptions, which are translated into a set of criteria used to</span>
<a name="line-548"></a><span class='hs-comment'>-- select the appropriate frame buffer configuration. The criteria are matched</span>
<a name="line-549"></a><span class='hs-comment'>-- in strict left to right order of precdence. That is, the first specified</span>
<a name="line-550"></a><span class='hs-comment'>-- criterion (leftmost) takes precedence over the later criteria for non-exact</span>
<a name="line-551"></a><span class='hs-comment'>-- criteria ('IsGreaterThan', 'IsLessThan', etc.). Exact criteria ('IsEqualTo',</span>
<a name="line-552"></a><span class='hs-comment'>-- 'IsNotEqualTo') must match exactly so precedence is not relevant.</span>
<a name="line-553"></a><span class='hs-comment'>--</span>
<a name="line-554"></a><span class='hs-comment'>-- Unspecified capability descriptions will result in unspecified criteria being</span>
<a name="line-555"></a><span class='hs-comment'>-- generated. These unspecified criteria help 'initialDisplayCapabilities'</span>
<a name="line-556"></a><span class='hs-comment'>-- behave sensibly with terse display mode descriptions.</span>
<a name="line-557"></a><span class='hs-comment'>--</span>
<a name="line-558"></a><span class='hs-comment'>-- Here is an example using 'initialDisplayCapabilities':</span>
<a name="line-559"></a><span class='hs-comment'>--</span>
<a name="line-560"></a><span class='hs-comment'>-- @</span>
<a name="line-561"></a><span class='hs-comment'>-- initialDisplayCapabilities $= [ With DisplayRGB,</span>
<a name="line-562"></a><span class='hs-comment'>-- Where DisplayDepth IsAtLeast 16,</span>
<a name="line-563"></a><span class='hs-comment'>-- With DisplaySamples,</span>
<a name="line-564"></a><span class='hs-comment'>-- Where DisplayStencil IsNotLessThan 2,</span>
<a name="line-565"></a><span class='hs-comment'>-- With DisplayDouble ]</span>
<a name="line-566"></a><span class='hs-comment'>-- @</span>
<a name="line-567"></a><span class='hs-comment'>--</span>
<a name="line-568"></a><span class='hs-comment'>-- The above call requests a window with an RGBA color model (but requesting</span>
<a name="line-569"></a><span class='hs-comment'>-- no bits of alpha), a depth buffer with at least 16 bits of precision but</span>
<a name="line-570"></a><span class='hs-comment'>-- preferring more, multisampling if available, at least 2 bits of stencil</span>
<a name="line-571"></a><span class='hs-comment'>-- (favoring less stencil to more as long as 2 bits are available), and double</span>
<a name="line-572"></a><span class='hs-comment'>-- buffering.</span>
<a name="line-573"></a>
<a name="line-574"></a><a name="initialDisplayCapabilities"></a><span class='hs-definition'>initialDisplayCapabilities</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>SettableStateVar</span> <span class='hs-keyglyph'>[</span><span class='hs-conid'>DisplayCapabilityDescription</span><span class='hs-keyglyph'>]</span>
<a name="line-575"></a><span class='hs-definition'>initialDisplayCapabilities</span> <span class='hs-keyglyph'>=</span>
<a name="line-576"></a> <span class='hs-varid'>makeSettableStateVar</span> <span class='hs-varop'>$</span> <span class='hs-keyglyph'>\</span><span class='hs-varid'>caps</span> <span class='hs-keyglyph'>-></span>
<a name="line-577"></a> <span class='hs-varid'>withCString</span>
<a name="line-578"></a> <span class='hs-layout'>(</span><span class='hs-varid'>concat</span> <span class='hs-varop'>.</span> <span class='hs-varid'>intersperse</span> <span class='hs-str'>" "</span> <span class='hs-varop'>.</span> <span class='hs-varid'>map</span> <span class='hs-varid'>displayCapabilityDescriptionToString</span> <span class='hs-varop'>$</span>
<a name="line-579"></a> <span class='hs-varid'>caps</span><span class='hs-layout'>)</span>
<a name="line-580"></a> <span class='hs-varid'>glutInitDisplayString</span>
<a name="line-581"></a>
<a name="line-582"></a><span class='hs-comment'>-----------------------------------------------------------------------------</span>
<a name="line-583"></a>
<a name="line-584"></a><span class='hs-comment'>-- | How rendering context for new windows are created.</span>
<a name="line-585"></a>
<a name="line-586"></a><a name="RenderingContext"></a><span class='hs-keyword'>data</span> <span class='hs-conid'>RenderingContext</span>
<a name="line-587"></a> <span class='hs-keyglyph'>=</span> <span class='hs-comment'>-- | Create a new context via @glXCreateContext@ or @wglCreateContext@</span>
<a name="line-588"></a> <span class='hs-comment'>-- (default).</span>
<a name="line-589"></a> <span class='hs-conid'>CreateNewContext</span>
<a name="line-590"></a> <span class='hs-keyglyph'>|</span> <span class='hs-comment'>-- | Re-use the current rendering context.</span>
<a name="line-591"></a> <span class='hs-conid'>UseCurrentContext</span>
<a name="line-592"></a> <span class='hs-keyword'>deriving</span> <span class='hs-layout'>(</span> <span class='hs-conid'>Eq</span><span class='hs-layout'>,</span> <span class='hs-conid'>Ord</span><span class='hs-layout'>,</span> <span class='hs-conid'>Show</span> <span class='hs-layout'>)</span>
<a name="line-593"></a>
<a name="line-594"></a><a name="marshalRenderingContext"></a><span class='hs-definition'>marshalRenderingContext</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>RenderingContext</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>CInt</span>
<a name="line-595"></a><span class='hs-definition'>marshalRenderingContext</span> <span class='hs-conid'>CreateNewContext</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>glut_CREATE_NEW_CONTEXT</span>
<a name="line-596"></a><span class='hs-definition'>marshalRenderingContext</span> <span class='hs-conid'>UseCurrentContext</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>glut_USE_CURRENT_CONTEXT</span>
<a name="line-597"></a>
<a name="line-598"></a><a name="unmarshalRenderingContext"></a><span class='hs-definition'>unmarshalRenderingContext</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>CInt</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>RenderingContext</span>
<a name="line-599"></a><span class='hs-definition'>unmarshalRenderingContext</span> <span class='hs-varid'>r</span>
<a name="line-600"></a> <span class='hs-keyglyph'>|</span> <span class='hs-varid'>r</span> <span class='hs-varop'>==</span> <span class='hs-varid'>glut_CREATE_NEW_CONTEXT</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>CreateNewContext</span>
<a name="line-601"></a> <span class='hs-keyglyph'>|</span> <span class='hs-varid'>r</span> <span class='hs-varop'>==</span> <span class='hs-varid'>glut_USE_CURRENT_CONTEXT</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>UseCurrentContext</span>
<a name="line-602"></a> <span class='hs-keyglyph'>|</span> <span class='hs-varid'>otherwise</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>error</span> <span class='hs-str'>"unmarshalRenderingContext"</span>
<a name="line-603"></a>
<a name="line-604"></a><span class='hs-comment'>-----------------------------------------------------------------------------</span>
<a name="line-605"></a>
<a name="line-606"></a><span class='hs-comment'>-- | (/freeglut only/) Controls the creation of rendering contexts for new</span>
<a name="line-607"></a><span class='hs-comment'>-- windows.</span>
<a name="line-608"></a>
<a name="line-609"></a><a name="renderingContext"></a><span class='hs-definition'>renderingContext</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>StateVar</span> <span class='hs-conid'>RenderingContext</span>
<a name="line-610"></a><span class='hs-definition'>renderingContext</span> <span class='hs-keyglyph'>=</span>
<a name="line-611"></a> <span class='hs-varid'>makeStateVar</span>
<a name="line-612"></a> <span class='hs-layout'>(</span><span class='hs-varid'>simpleGet</span> <span class='hs-varid'>unmarshalRenderingContext</span> <span class='hs-varid'>glut_RENDERING_CONTEXT</span><span class='hs-layout'>)</span>
<a name="line-613"></a> <span class='hs-layout'>(</span><span class='hs-varid'>glutSetOption</span> <span class='hs-varid'>glut_RENDERING_CONTEXT</span> <span class='hs-varop'>.</span> <span class='hs-varid'>marshalRenderingContext</span><span class='hs-layout'>)</span>
<a name="line-614"></a>
<a name="line-615"></a><span class='hs-comment'>-----------------------------------------------------------------------------</span>
<a name="line-616"></a>
<a name="line-617"></a><span class='hs-comment'>-- | The kind of GLX rendering context used. Direct rendering provides a</span>
<a name="line-618"></a><span class='hs-comment'>-- performance advantage in some implementations. However, direct rendering</span>
<a name="line-619"></a><span class='hs-comment'>-- contexts cannot be shared outside a single process, and they may be unable</span>
<a name="line-620"></a><span class='hs-comment'>-- to render to GLX pixmaps.</span>
<a name="line-621"></a>
<a name="line-622"></a><a name="DirectRendering"></a><span class='hs-keyword'>data</span> <span class='hs-conid'>DirectRendering</span>
<a name="line-623"></a> <span class='hs-keyglyph'>=</span> <span class='hs-comment'>-- | Rendering is always done through the X server. This corresponds to</span>
<a name="line-624"></a> <span class='hs-comment'>-- the command line argument @-indirect@, see 'initialize'.</span>
<a name="line-625"></a> <span class='hs-conid'>ForceIndirectContext</span>
<a name="line-626"></a> <span class='hs-keyglyph'>|</span> <span class='hs-comment'>-- | Try to use direct rendering, silently using indirect rendering if this</span>
<a name="line-627"></a> <span class='hs-comment'>-- is not possible.</span>
<a name="line-628"></a> <span class='hs-conid'>AllowDirectContext</span>
<a name="line-629"></a> <span class='hs-keyglyph'>|</span> <span class='hs-comment'>-- | Try to use direct rendering, issue a warning and use indirect</span>
<a name="line-630"></a> <span class='hs-comment'>-- rendering if this is not possible.</span>
<a name="line-631"></a> <span class='hs-conid'>TryDirectContext</span>
<a name="line-632"></a> <span class='hs-keyglyph'>|</span> <span class='hs-comment'>-- | Try to use direct rendering, issue an error and terminate the program</span>
<a name="line-633"></a> <span class='hs-comment'>-- if this is not possible.This corresponds to the command line argument</span>
<a name="line-634"></a> <span class='hs-comment'>-- @-direct@, see 'initialize'.</span>
<a name="line-635"></a> <span class='hs-conid'>ForceDirectContext</span>
<a name="line-636"></a> <span class='hs-keyword'>deriving</span> <span class='hs-layout'>(</span> <span class='hs-conid'>Eq</span><span class='hs-layout'>,</span> <span class='hs-conid'>Ord</span><span class='hs-layout'>,</span> <span class='hs-conid'>Show</span> <span class='hs-layout'>)</span>
<a name="line-637"></a>
<a name="line-638"></a><a name="marshalDirectRendering"></a><span class='hs-definition'>marshalDirectRendering</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>DirectRendering</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>CInt</span>
<a name="line-639"></a><span class='hs-definition'>marshalDirectRendering</span> <span class='hs-varid'>x</span> <span class='hs-keyglyph'>=</span> <span class='hs-keyword'>case</span> <span class='hs-varid'>x</span> <span class='hs-keyword'>of</span>
<a name="line-640"></a> <span class='hs-conid'>ForceIndirectContext</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>glut_FORCE_INDIRECT_CONTEXT</span>
<a name="line-641"></a> <span class='hs-conid'>AllowDirectContext</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>glut_ALLOW_DIRECT_CONTEXT</span>
<a name="line-642"></a> <span class='hs-conid'>TryDirectContext</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>glut_TRY_DIRECT_CONTEXT</span>
<a name="line-643"></a> <span class='hs-conid'>ForceDirectContext</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>glut_FORCE_DIRECT_CONTEXT</span>
<a name="line-644"></a>
<a name="line-645"></a><a name="unmarshalDirectRendering"></a><span class='hs-definition'>unmarshalDirectRendering</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>CInt</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>DirectRendering</span>
<a name="line-646"></a><span class='hs-definition'>unmarshalDirectRendering</span> <span class='hs-varid'>x</span>
<a name="line-647"></a> <span class='hs-keyglyph'>|</span> <span class='hs-varid'>x</span> <span class='hs-varop'>==</span> <span class='hs-varid'>glut_FORCE_INDIRECT_CONTEXT</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>ForceIndirectContext</span>
<a name="line-648"></a> <span class='hs-keyglyph'>|</span> <span class='hs-varid'>x</span> <span class='hs-varop'>==</span> <span class='hs-varid'>glut_ALLOW_DIRECT_CONTEXT</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>AllowDirectContext</span>
<a name="line-649"></a> <span class='hs-keyglyph'>|</span> <span class='hs-varid'>x</span> <span class='hs-varop'>==</span> <span class='hs-varid'>glut_TRY_DIRECT_CONTEXT</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>TryDirectContext</span>
<a name="line-650"></a> <span class='hs-keyglyph'>|</span> <span class='hs-varid'>x</span> <span class='hs-varop'>==</span> <span class='hs-varid'>glut_FORCE_DIRECT_CONTEXT</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>ForceDirectContext</span>
<a name="line-651"></a> <span class='hs-keyglyph'>|</span> <span class='hs-varid'>otherwise</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>error</span> <span class='hs-layout'>(</span><span class='hs-str'>"unmarshalDirectRendering: illegal value "</span> <span class='hs-varop'>++</span> <span class='hs-varid'>show</span> <span class='hs-varid'>x</span><span class='hs-layout'>)</span>
<a name="line-652"></a>
<a name="line-653"></a><span class='hs-comment'>-----------------------------------------------------------------------------</span>
<a name="line-654"></a>
<a name="line-655"></a><span class='hs-comment'>-- | (/freeglut on X11 only/) Controls which kind of rendering context is</span>
<a name="line-656"></a><span class='hs-comment'>-- created when a new one is required.</span>
<a name="line-657"></a>
<a name="line-658"></a><a name="directRendering"></a><span class='hs-definition'>directRendering</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>StateVar</span> <span class='hs-conid'>DirectRendering</span>
<a name="line-659"></a><span class='hs-definition'>directRendering</span> <span class='hs-keyglyph'>=</span>
<a name="line-660"></a> <span class='hs-varid'>makeStateVar</span>
<a name="line-661"></a> <span class='hs-layout'>(</span><span class='hs-varid'>simpleGet</span> <span class='hs-varid'>unmarshalDirectRendering</span> <span class='hs-varid'>glut_DIRECT_RENDERING</span><span class='hs-layout'>)</span>
<a name="line-662"></a> <span class='hs-layout'>(</span><span class='hs-varid'>glutSetOption</span> <span class='hs-varid'>glut_DIRECT_RENDERING</span> <span class='hs-varop'>.</span> <span class='hs-varid'>marshalDirectRendering</span><span class='hs-layout'>)</span>
<a name="line-663"></a>
<a name="line-664"></a><span class='hs-comment'>-----------------------------------------------------------------------------</span>
<a name="line-665"></a>
<a name="line-666"></a><span class='hs-comment'>-- | (/freeglut only/) Controls the API major\/minor version of the OpenGL</span>
<a name="line-667"></a><span class='hs-comment'>-- context. If a version less than or equal to 2.1 is requested, the context</span>
<a name="line-668"></a><span class='hs-comment'>-- returned may implement any version no less than that requested and no</span>
<a name="line-669"></a><span class='hs-comment'>-- greater than 2.1. If version 3.0 is requested, the context returned must</span>
<a name="line-670"></a><span class='hs-comment'>-- implement exactly version 3.0. Versioning behavior once GL versions beyond</span>
<a name="line-671"></a><span class='hs-comment'>-- 3.0 are defined will be defined by an amendment to the OpenGL specification</span>
<a name="line-672"></a><span class='hs-comment'>-- to define dependencies on such GL versions.</span>
<a name="line-673"></a><span class='hs-comment'>--</span>
<a name="line-674"></a><span class='hs-comment'>-- 'Graphics.Rendering.OpenGL.GL.StringQueries.glVersion' and</span>
<a name="line-675"></a><span class='hs-comment'>-- 'Graphics.Rendering.OpenGL.GL.StringQueries.majorMinor' will return the</span>
<a name="line-676"></a><span class='hs-comment'>-- actual version supported by a context.</span>
<a name="line-677"></a><span class='hs-comment'>--</span>
<a name="line-678"></a><span class='hs-comment'>-- The default context version is (1, 0), which will typically return an</span>
<a name="line-679"></a><span class='hs-comment'>-- OpenGL 2.1 context, if one is available.</span>
<a name="line-680"></a>
<a name="line-681"></a><a name="initialContextVersion"></a><span class='hs-definition'>initialContextVersion</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>StateVar</span> <span class='hs-layout'>(</span><span class='hs-conid'>Int</span><span class='hs-layout'>,</span> <span class='hs-conid'>Int</span><span class='hs-layout'>)</span>
<a name="line-682"></a><span class='hs-definition'>initialContextVersion</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>makeStateVar</span> <span class='hs-varid'>getContextVersion</span> <span class='hs-varid'>setContextVersion</span>
<a name="line-683"></a>
<a name="line-684"></a><a name="getContextVersion"></a><span class='hs-definition'>getContextVersion</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>IO</span> <span class='hs-layout'>(</span><span class='hs-conid'>Int</span><span class='hs-layout'>,</span> <span class='hs-conid'>Int</span><span class='hs-layout'>)</span>
<a name="line-685"></a><span class='hs-definition'>getContextVersion</span> <span class='hs-keyglyph'>=</span> <span class='hs-keyword'>do</span>
<a name="line-686"></a> <span class='hs-varid'>major</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>simpleGet</span> <span class='hs-varid'>fromIntegral</span> <span class='hs-varid'>glut_INIT_MAJOR_VERSION</span>
<a name="line-687"></a> <span class='hs-varid'>minor</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>simpleGet</span> <span class='hs-varid'>fromIntegral</span> <span class='hs-varid'>glut_INIT_MINOR_VERSION</span>
<a name="line-688"></a> <span class='hs-varid'>return</span> <span class='hs-layout'>(</span><span class='hs-varid'>major</span><span class='hs-layout'>,</span> <span class='hs-varid'>minor</span><span class='hs-layout'>)</span>
<a name="line-689"></a>
<a name="line-690"></a><a name="setContextVersion"></a><span class='hs-definition'>setContextVersion</span> <span class='hs-keyglyph'>::</span> <span class='hs-layout'>(</span><span class='hs-conid'>Int</span><span class='hs-layout'>,</span> <span class='hs-conid'>Int</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>IO</span> <span class='hs-conid'>()</span>
<a name="line-691"></a><span class='hs-definition'>setContextVersion</span> <span class='hs-layout'>(</span><span class='hs-varid'>major</span><span class='hs-layout'>,</span> <span class='hs-varid'>minor</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>=</span>
<a name="line-692"></a> <span class='hs-varid'>glutInitContextVersion</span> <span class='hs-layout'>(</span><span class='hs-varid'>fromIntegral</span> <span class='hs-varid'>major</span><span class='hs-layout'>)</span> <span class='hs-layout'>(</span><span class='hs-varid'>fromIntegral</span> <span class='hs-varid'>minor</span><span class='hs-layout'>)</span>
<a name="line-693"></a>
<a name="line-694"></a><span class='hs-comment'>-----------------------------------------------------------------------------</span>
<a name="line-695"></a>
<a name="line-696"></a><span class='hs-comment'>-- | A flag affecting the rendering context to create, used in conjunction</span>
<a name="line-697"></a><span class='hs-comment'>-- with 'initialContextFlags'.</span>
<a name="line-698"></a>
<a name="line-699"></a><a name="ContextFlag"></a><span class='hs-keyword'>data</span> <span class='hs-conid'>ContextFlag</span>
<a name="line-700"></a> <span class='hs-keyglyph'>=</span> <span class='hs-comment'>-- | Debug contexts are intended for use during application development,</span>
<a name="line-701"></a> <span class='hs-comment'>-- and provide additional runtime checking, validation, and logging</span>
<a name="line-702"></a> <span class='hs-comment'>-- functionality while possibly incurring performance penalties. The</span>
<a name="line-703"></a> <span class='hs-comment'>-- additional functionality provided by debug contexts may vary according</span>
<a name="line-704"></a> <span class='hs-comment'>-- to the implementation. In some cases a debug context may be identical</span>
<a name="line-705"></a> <span class='hs-comment'>-- to a non-debug context.</span>
<a name="line-706"></a> <span class='hs-conid'>DebugContext</span>
<a name="line-707"></a> <span class='hs-keyglyph'>|</span> <span class='hs-comment'>-- | Forward-compatible contexts are defined only for OpenGL versions 3.0</span>
<a name="line-708"></a> <span class='hs-comment'>-- and later. They must not support functionality marked as /deprecated/</span>
<a name="line-709"></a> <span class='hs-comment'>-- by that version of the API, while a non-forward-compatible context must</span>
<a name="line-710"></a> <span class='hs-comment'>-- support all functionality in that version, deprecated or not.</span>
<a name="line-711"></a> <span class='hs-conid'>ForwardCompatibleContext</span>
<a name="line-712"></a> <span class='hs-keyword'>deriving</span> <span class='hs-layout'>(</span> <span class='hs-conid'>Eq</span><span class='hs-layout'>,</span> <span class='hs-conid'>Ord</span><span class='hs-layout'>,</span> <span class='hs-conid'>Show</span> <span class='hs-layout'>)</span>
<a name="line-713"></a>
<a name="line-714"></a><a name="marshalContextFlag"></a><span class='hs-definition'>marshalContextFlag</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>ContextFlag</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>CInt</span>
<a name="line-715"></a><span class='hs-definition'>marshalContextFlag</span> <span class='hs-varid'>x</span> <span class='hs-keyglyph'>=</span> <span class='hs-keyword'>case</span> <span class='hs-varid'>x</span> <span class='hs-keyword'>of</span>
<a name="line-716"></a> <span class='hs-conid'>DebugContext</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>glut_DEBUG</span>
<a name="line-717"></a> <span class='hs-conid'>ForwardCompatibleContext</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>glut_FORWARD_COMPATIBLE</span>
<a name="line-718"></a>
<a name="line-719"></a><span class='hs-comment'>-----------------------------------------------------------------------------</span>
<a name="line-720"></a>
<a name="line-721"></a><span class='hs-comment'>-- | (/freeglut only/) Controls the set of flags for the rendering context.</span>
<a name="line-722"></a>
<a name="line-723"></a><a name="initialContextFlags"></a><span class='hs-definition'>initialContextFlags</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>StateVar</span> <span class='hs-keyglyph'>[</span><span class='hs-conid'>ContextFlag</span><span class='hs-keyglyph'>]</span>
<a name="line-724"></a><span class='hs-definition'>initialContextFlags</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>makeStateVar</span> <span class='hs-varid'>getContextFlags</span> <span class='hs-varid'>setContextFlags</span>
<a name="line-725"></a>
<a name="line-726"></a><a name="getContextFlags"></a><span class='hs-definition'>getContextFlags</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>IO</span> <span class='hs-keyglyph'>[</span><span class='hs-conid'>ContextFlag</span><span class='hs-keyglyph'>]</span>
<a name="line-727"></a><span class='hs-definition'>getContextFlags</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>simpleGet</span> <span class='hs-varid'>i2cfs</span> <span class='hs-varid'>glut_INIT_FLAGS</span>
<a name="line-728"></a>
<a name="line-729"></a><a name="i2cfs"></a><span class='hs-definition'>i2cfs</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>CInt</span> <span class='hs-keyglyph'>-></span> <span class='hs-keyglyph'>[</span><span class='hs-conid'>ContextFlag</span><span class='hs-keyglyph'>]</span>
<a name="line-730"></a><span class='hs-definition'>i2cfs</span> <span class='hs-varid'>bitfield</span> <span class='hs-keyglyph'>=</span>
<a name="line-731"></a> <span class='hs-keyglyph'>[</span> <span class='hs-varid'>c</span> <span class='hs-keyglyph'>|</span> <span class='hs-varid'>c</span> <span class='hs-keyglyph'><-</span> <span class='hs-keyglyph'>[</span> <span class='hs-conid'>DebugContext</span><span class='hs-layout'>,</span> <span class='hs-conid'>ForwardCompatibleContext</span> <span class='hs-keyglyph'>]</span>
<a name="line-732"></a> <span class='hs-layout'>,</span> <span class='hs-layout'>(</span><span class='hs-varid'>fromIntegral</span> <span class='hs-varid'>bitfield</span> <span class='hs-varop'>.&.</span> <span class='hs-varid'>marshalContextFlag</span> <span class='hs-varid'>c</span><span class='hs-layout'>)</span> <span class='hs-varop'>/=</span> <span class='hs-num'>0</span> <span class='hs-keyglyph'>]</span>
<a name="line-733"></a>
<a name="line-734"></a><a name="setContextFlags"></a><span class='hs-definition'>setContextFlags</span> <span class='hs-keyglyph'>::</span> <span class='hs-keyglyph'>[</span><span class='hs-conid'>ContextFlag</span><span class='hs-keyglyph'>]</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>IO</span> <span class='hs-conid'>()</span>
<a name="line-735"></a><span class='hs-definition'>setContextFlags</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>glutInitContextFlags</span> <span class='hs-varop'>.</span> <span class='hs-varid'>toBitfield</span> <span class='hs-varid'>marshalContextFlag</span>
<a name="line-736"></a>
<a name="line-737"></a>
<a name="line-738"></a><span class='hs-comment'>-----------------------------------------------------------------------------</span>
<a name="line-739"></a>
<a name="line-740"></a><span class='hs-comment'>-- | An OpenGL API profile, affecting the rendering context to create, used</span>
<a name="line-741"></a><span class='hs-comment'>-- in conjunction with 'initialContextProfile'.</span>
<a name="line-742"></a>
<a name="line-743"></a><a name="ContextProfile"></a><span class='hs-keyword'>data</span> <span class='hs-conid'>ContextProfile</span>
<a name="line-744"></a> <span class='hs-keyglyph'>=</span> <span class='hs-comment'>-- | The OpenGL /core/ profile, which all OpenGL 3.2 implementations</span>
<a name="line-745"></a> <span class='hs-comment'>-- are required to support.</span>
<a name="line-746"></a> <span class='hs-conid'>CoreProfile</span>
<a name="line-747"></a> <span class='hs-keyglyph'>|</span> <span class='hs-comment'>-- | The OpenGL /compatibility/ profile, which is optional for OpenGL</span>
<a name="line-748"></a> <span class='hs-comment'>-- 3.2 implementations.</span>
<a name="line-749"></a> <span class='hs-conid'>CompatibilityProfile</span>
<a name="line-750"></a> <span class='hs-keyword'>deriving</span> <span class='hs-layout'>(</span> <span class='hs-conid'>Eq</span><span class='hs-layout'>,</span> <span class='hs-conid'>Ord</span><span class='hs-layout'>,</span> <span class='hs-conid'>Show</span> <span class='hs-layout'>)</span>
<a name="line-751"></a>
<a name="line-752"></a><a name="marshalContextProfile"></a><span class='hs-definition'>marshalContextProfile</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>ContextProfile</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>CInt</span>
<a name="line-753"></a><span class='hs-definition'>marshalContextProfile</span> <span class='hs-varid'>x</span> <span class='hs-keyglyph'>=</span> <span class='hs-keyword'>case</span> <span class='hs-varid'>x</span> <span class='hs-keyword'>of</span>
<a name="line-754"></a> <span class='hs-conid'>CoreProfile</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>glut_CORE_PROFILE</span>
<a name="line-755"></a> <span class='hs-conid'>CompatibilityProfile</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>glut_COMPATIBILITY_PROFILE</span>
<a name="line-756"></a>
<a name="line-757"></a><span class='hs-comment'>-----------------------------------------------------------------------------</span>
<a name="line-758"></a>
<a name="line-759"></a><span class='hs-comment'>-- | (/freeglut only/) Controls the set of profiles for the rendering context.</span>
<a name="line-760"></a>
<a name="line-761"></a><a name="initialContextProfile"></a><span class='hs-definition'>initialContextProfile</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>StateVar</span> <span class='hs-keyglyph'>[</span><span class='hs-conid'>ContextProfile</span><span class='hs-keyglyph'>]</span>
<a name="line-762"></a><span class='hs-definition'>initialContextProfile</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>makeStateVar</span> <span class='hs-varid'>getContextProfiles</span> <span class='hs-varid'>setContextProfiles</span>
<a name="line-763"></a>
<a name="line-764"></a><a name="getContextProfiles"></a><span class='hs-definition'>getContextProfiles</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>IO</span> <span class='hs-keyglyph'>[</span><span class='hs-conid'>ContextProfile</span><span class='hs-keyglyph'>]</span>
<a name="line-765"></a><span class='hs-definition'>getContextProfiles</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>simpleGet</span> <span class='hs-varid'>i2cps</span> <span class='hs-varid'>glut_INIT_PROFILE</span>
<a name="line-766"></a>
<a name="line-767"></a><a name="i2cps"></a><span class='hs-definition'>i2cps</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>CInt</span> <span class='hs-keyglyph'>-></span> <span class='hs-keyglyph'>[</span><span class='hs-conid'>ContextProfile</span><span class='hs-keyglyph'>]</span>
<a name="line-768"></a><span class='hs-definition'>i2cps</span> <span class='hs-varid'>bitfield</span> <span class='hs-keyglyph'>=</span>
<a name="line-769"></a> <span class='hs-keyglyph'>[</span> <span class='hs-varid'>c</span> <span class='hs-keyglyph'>|</span> <span class='hs-varid'>c</span> <span class='hs-keyglyph'><-</span> <span class='hs-keyglyph'>[</span> <span class='hs-conid'>CoreProfile</span><span class='hs-layout'>,</span> <span class='hs-conid'>CompatibilityProfile</span> <span class='hs-keyglyph'>]</span>
<a name="line-770"></a> <span class='hs-layout'>,</span> <span class='hs-layout'>(</span><span class='hs-varid'>fromIntegral</span> <span class='hs-varid'>bitfield</span> <span class='hs-varop'>.&.</span> <span class='hs-varid'>marshalContextProfile</span> <span class='hs-varid'>c</span><span class='hs-layout'>)</span> <span class='hs-varop'>/=</span> <span class='hs-num'>0</span> <span class='hs-keyglyph'>]</span>
<a name="line-771"></a>
<a name="line-772"></a><a name="setContextProfiles"></a><span class='hs-definition'>setContextProfiles</span> <span class='hs-keyglyph'>::</span> <span class='hs-keyglyph'>[</span><span class='hs-conid'>ContextProfile</span><span class='hs-keyglyph'>]</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>IO</span> <span class='hs-conid'>()</span>
<a name="line-773"></a><span class='hs-definition'>setContextProfiles</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>glutInitContextProfile</span> <span class='hs-varop'>.</span> <span class='hs-varid'>toBitfield</span> <span class='hs-varid'>marshalContextProfile</span>
</pre></body>
</html>
|