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 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>AllegroGL: alleggl.c Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript">
$(document).ready(initResizable);
</script>
<link href="alleggl.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.7.3 -->
<div id="top">
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">AllegroGL <span id="projectnumber">0.4.4</span></div>
</td>
</tr>
</tbody>
</table>
</div>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="pages.html"><span>Related Pages</span></a></li>
<li><a href="modules.html"><span>Modules</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="files.html"><span>File List</span></a></li>
<li><a href="globals.html"><span>Globals</span></a></li>
</ul>
</div>
</div>
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
initNavTree('alleggl_8c.html','');
</script>
<div id="doc-content">
<div class="header">
<div class="headertitle">
<h1>alleggl.c</h1> </div>
</div>
<div class="contents">
<a href="alleggl_8c.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* This code is (C) AllegroGL contributors, and double licensed under</span>
<a name="l00002"></a>00002 <span class="comment"> * the GPL and zlib licenses. See gpl.txt or zlib.txt for details.</span>
<a name="l00003"></a>00003 <span class="comment"> */</span>
<a name="l00011"></a>00011 <span class="preprocessor">#include <string.h></span>
<a name="l00012"></a>00012 <span class="preprocessor">#include <stdlib.h></span>
<a name="l00013"></a>00013
<a name="l00014"></a>00014 <span class="preprocessor">#include "alleggl.h"</span>
<a name="l00015"></a>00015 <span class="preprocessor">#include "allglint.h"</span>
<a name="l00016"></a>00016
<a name="l00017"></a>00017 <span class="preprocessor">#include <allegro/internal/aintern.h></span>
<a name="l00018"></a>00018 <span class="preprocessor">#ifdef ALLEGRO_MACOSX</span>
<a name="l00019"></a>00019 <span class="preprocessor"></span><span class="preprocessor">#include <OpenGL/glu.h></span>
<a name="l00020"></a>00020 <span class="preprocessor">#else</span>
<a name="l00021"></a>00021 <span class="preprocessor"></span><span class="preprocessor">#include <GL/glu.h></span>
<a name="l00022"></a>00022 <span class="preprocessor">#endif</span>
<a name="l00023"></a>00023 <span class="preprocessor"></span>
<a name="l00024"></a>00024 <span class="preprocessor">#define PREFIX_I "agl INFO: "</span>
<a name="l00025"></a>00025 <span class="preprocessor"></span><span class="preprocessor">#define PREFIX_E "agl ERROR: "</span>
<a name="l00026"></a>00026 <span class="preprocessor"></span><span class="preprocessor">#define PREFIX_L "agl LOG: "</span>
<a name="l00027"></a>00027 <span class="preprocessor"></span>
<a name="l00028"></a>00028
<a name="l00029"></a>00029 <span class="comment">/* Structs containing the current driver state */</span>
<a name="l00030"></a>00030 <span class="keyword">struct </span>allegro_gl_driver *__allegro_gl_driver = NULL;
<a name="l00031"></a>00031 <span class="keyword">struct </span>allegro_gl_display_info allegro_gl_display_info;
<a name="l00032"></a>00032
<a name="l00033"></a>00033 <span class="comment">/* Settings required/suggested */</span>
<a name="l00034"></a>00034 <span class="keywordtype">int</span> __allegro_gl_required_settings, __allegro_gl_suggested_settings;
<a name="l00035"></a>00035
<a name="l00036"></a>00036 <span class="comment">/* Valid context state */</span>
<a name="l00037"></a>00037 <span class="keywordtype">int</span> __allegro_gl_valid_context = 0;
<a name="l00038"></a>00038
<a name="l00039"></a>00039
<a name="l00040"></a>00040 <span class="comment">/* Operation to enable while blitting. */</span>
<a name="l00041"></a>00041 <span class="keywordtype">int</span> __allegro_gl_blit_operation;
<a name="l00042"></a>00042
<a name="l00043"></a>00043
<a name="l00044"></a>00044 <span class="keywordtype">char</span> allegro_gl_error[AGL_ERROR_SIZE] = EMPTY_STRING;
<a name="l00045"></a>00045
<a name="l00046"></a>00046 BLIT_BETWEEN_FORMATS_FUNC __blit_between_formats8;
<a name="l00047"></a>00047 BLIT_BETWEEN_FORMATS_FUNC __blit_between_formats15;
<a name="l00048"></a>00048 BLIT_BETWEEN_FORMATS_FUNC __blit_between_formats16;
<a name="l00049"></a>00049 BLIT_BETWEEN_FORMATS_FUNC __blit_between_formats24;
<a name="l00050"></a>00050 BLIT_BETWEEN_FORMATS_FUNC __blit_between_formats32;
<a name="l00051"></a>00051
<a name="l00052"></a>00052
<a name="l00053"></a>00053
<a name="l00062"></a><a class="code" href="alleggl_8c.html#a84d9cceae55bf273f9aab7512b353284">00062</a> BITMAP *<a class="code" href="alleggl_8c.html#a84d9cceae55bf273f9aab7512b353284" title="Direct-mode GL `screen&#39; bitmap.">allegro_gl_screen</a>;
<a name="l00063"></a>00063
<a name="l00064"></a>00064
<a name="l00065"></a>00065
<a name="l00066"></a>00066 <span class="comment">/* Allegro GFX_DRIVER list handling */</span>
<a name="l00067"></a>00067 <span class="keyword">static</span> _DRIVER_INFO our_driver_list[] = {
<a name="l00068"></a>00068 <span class="preprocessor">#ifdef GFX_OPENGL_WINDOWED</span>
<a name="l00069"></a>00069 <span class="preprocessor"></span> {<a class="code" href="alleggl_8h.html#a5fcf0497998fecc3c04bb5b6ce66782b" title="Windowed OpenGL graphics driver for Allegro.">GFX_OPENGL_WINDOWED</a>, &gfx_allegro_gl_windowed, FALSE},
<a name="l00070"></a>00070 <span class="preprocessor">#endif</span>
<a name="l00071"></a>00071 <span class="preprocessor"></span><span class="preprocessor">#ifdef GFX_OPENGL_FULLSCREEN</span>
<a name="l00072"></a>00072 <span class="preprocessor"></span> {<a class="code" href="alleggl_8h.html#afd00c615b3351d54382b5f883b99544f" title="Fullscreen OpenGL graphics driver for Allegro.">GFX_OPENGL_FULLSCREEN</a>, &gfx_allegro_gl_fullscreen, FALSE},
<a name="l00073"></a>00073 <span class="preprocessor">#endif</span>
<a name="l00074"></a>00074 <span class="preprocessor"></span> {<a class="code" href="alleggl_8h.html#a6341d90e32c19c45f003442b19ecba5f" title="Non-specific OpenGL graphics driver for Allegro.">GFX_OPENGL</a>, &gfx_allegro_gl_default, FALSE},
<a name="l00075"></a>00075 {0, NULL, FALSE}
<a name="l00076"></a>00076 };
<a name="l00077"></a>00077
<a name="l00078"></a>00078
<a name="l00079"></a>00079
<a name="l00080"></a>00080 <span class="keyword">static</span> _DRIVER_INFO *our_gfx_drivers(<span class="keywordtype">void</span>)
<a name="l00081"></a>00081 {
<a name="l00082"></a>00082 <span class="keywordflow">return</span> our_driver_list;
<a name="l00083"></a>00083 }
<a name="l00084"></a>00084
<a name="l00085"></a>00085
<a name="l00086"></a>00086
<a name="l00087"></a>00087 _DRIVER_INFO *(*saved_gfx_drivers) (void) = NULL;
<a name="l00088"></a>00088
<a name="l00089"></a>00089
<a name="l00090"></a>00090
<a name="l00091"></a>00091 <span class="keyword">static</span> _DRIVER_INFO *list_saved_gfx_drivers(<span class="keywordtype">void</span>)
<a name="l00092"></a>00092 {
<a name="l00093"></a>00093 <span class="keywordflow">return</span> _gfx_driver_list;
<a name="l00094"></a>00094 }
<a name="l00095"></a>00095
<a name="l00096"></a>00096
<a name="l00097"></a>00097
<a name="l00098"></a>00098 <span class="keyword">static</span> BITMAP *allegro_gl_default_gfx_init(<span class="keywordtype">int</span> w, <span class="keywordtype">int</span> h, <span class="keywordtype">int</span> vw, <span class="keywordtype">int</span> vh, <span class="keywordtype">int</span> depth);
<a name="l00099"></a>00099
<a name="l00100"></a>00100
<a name="l00101"></a>00101
<a name="l00102"></a>00102 GFX_DRIVER gfx_allegro_gl_default =
<a name="l00103"></a>00103 {
<a name="l00104"></a>00104 <a class="code" href="alleggl_8h.html#a6341d90e32c19c45f003442b19ecba5f" title="Non-specific OpenGL graphics driver for Allegro.">GFX_OPENGL</a>,
<a name="l00105"></a>00105 EMPTY_STRING,
<a name="l00106"></a>00106 EMPTY_STRING,
<a name="l00107"></a>00107 <span class="stringliteral">"AllegroGL Default Driver"</span>,
<a name="l00108"></a>00108 allegro_gl_default_gfx_init,
<a name="l00109"></a>00109 NULL,
<a name="l00110"></a>00110 NULL,
<a name="l00111"></a>00111 NULL, <span class="comment">//_xwin_vsync,</span>
<a name="l00112"></a>00112 NULL,
<a name="l00113"></a>00113 NULL, NULL, NULL,
<a name="l00114"></a>00114 NULL, <span class="comment">/* create_video_bitmap */</span>
<a name="l00115"></a>00115 NULL,
<a name="l00116"></a>00116 NULL, NULL, <span class="comment">/* No show/request video bitmaps */</span>
<a name="l00117"></a>00117 NULL, NULL,
<a name="l00118"></a>00118 NULL, NULL, NULL, NULL,
<a name="l00119"></a>00119 NULL,
<a name="l00120"></a>00120 NULL, NULL,
<a name="l00121"></a>00121 NULL, <span class="comment">/* set_blender_mode */</span>
<a name="l00122"></a>00122 NULL, <span class="comment">/* No fetch_mode_list */</span>
<a name="l00123"></a>00123 0, 0,
<a name="l00124"></a>00124 0,
<a name="l00125"></a>00125 0, 0,
<a name="l00126"></a>00126 0,
<a name="l00127"></a>00127 0,
<a name="l00128"></a>00128 FALSE <span class="comment">/* Windowed mode */</span>
<a name="l00129"></a>00129 };
<a name="l00130"></a>00130
<a name="l00131"></a>00131
<a name="l00132"></a>00132
<a name="l00176"></a>00176 <span class="comment">/* void allegro_gl_clear_settings(void) */</span>
<a name="l00193"></a><a class="code" href="group__settings.html#gadd1249980001c22cb3eba880561a7e19">00193</a> <span class="keywordtype">void</span> <a class="code" href="group__settings.html#gadd1249980001c22cb3eba880561a7e19" title="Clear the option settings All settings are set to their default values, and marked as neither suggest...">allegro_gl_clear_settings</a>(<span class="keywordtype">void</span>)
<a name="l00194"></a>00194 {
<a name="l00195"></a>00195 memset(&allegro_gl_display_info, 0, <span class="keyword">sizeof</span> allegro_gl_display_info);
<a name="l00196"></a>00196
<a name="l00197"></a>00197 __allegro_gl_required_settings = __allegro_gl_suggested_settings = 0;
<a name="l00198"></a>00198
<a name="l00199"></a>00199 <span class="comment">/* Pick sensible defaults */</span>
<a name="l00200"></a>00200 allegro_gl_display_info.fullscreen = 1;
<a name="l00201"></a>00201 allegro_gl_display_info.rmethod = 1;
<a name="l00202"></a>00202 allegro_gl_display_info.doublebuffered = 1;
<a name="l00203"></a>00203 allegro_gl_display_info.vidmem_policy = <a class="code" href="group__settings.html#ga5deef983a0f5b2704746d7945c614b7c" title="Keep internal texture in video memory.">AGL_KEEP</a>;
<a name="l00204"></a>00204 __allegro_gl_suggested_settings =
<a name="l00205"></a>00205 <a class="code" href="group__settings.html#ga1baffefcedaffebf7ca47724a0441e60" title="Set if you&#39;d like a full screen mode.">AGL_FULLSCREEN</a> | <a class="code" href="group__settings.html#ga3cd047a464c8f8d928f9529226a4cf12" title="Set it if you&#39;d like AllegroGL to pay special attention on whether hardware acceleration is prese...">AGL_RENDERMETHOD</a> | <a class="code" href="group__settings.html#gaa1150ae35d6ff9b33d5771f29f9770dd" title="Creates a backbuffer if set.">AGL_DOUBLEBUFFER</a>;
<a name="l00206"></a>00206 }
<a name="l00207"></a>00207
<a name="l00208"></a>00208
<a name="l00209"></a>00209
<a name="l00210"></a>00210 <span class="comment">/* void allegro_gl_set(int option, int value) */</span>
<a name="l00274"></a><a class="code" href="group__settings.html#ga025e79a4394803a0e15aaf07b1a8a656">00274</a> <span class="keywordtype">void</span> <a class="code" href="group__settings.html#ga025e79a4394803a0e15aaf07b1a8a656" title="Sets a configuration option.">allegro_gl_set</a>(<span class="keywordtype">int</span> option, <span class="keywordtype">int</span> value)
<a name="l00275"></a>00275 {
<a name="l00276"></a>00276 <span class="keywordflow">switch</span> (option) {
<a name="l00277"></a>00277 <span class="comment">/* Options stating importance of other options */</span>
<a name="l00278"></a>00278 <span class="keywordflow">case</span> <a class="code" href="group__settings.html#ga839ae567340a64a97480e6abf1743b5f" title="Reject other values for these settings.">AGL_REQUIRE</a>:
<a name="l00279"></a>00279 __allegro_gl_required_settings |= value;
<a name="l00280"></a>00280 __allegro_gl_suggested_settings &= ~value;
<a name="l00281"></a>00281 <span class="keywordflow">break</span>;
<a name="l00282"></a>00282 <span class="keywordflow">case</span> <a class="code" href="group__settings.html#ga5a1518fe9c1b44beb7f5bdcc42b6b8f1" title="Prefer the assigned values for these settings.">AGL_SUGGEST</a>:
<a name="l00283"></a>00283 __allegro_gl_suggested_settings |= value;
<a name="l00284"></a>00284 __allegro_gl_required_settings &= ~value;
<a name="l00285"></a>00285 <span class="keywordflow">break</span>;
<a name="l00286"></a>00286 <span class="keywordflow">case</span> <a class="code" href="group__settings.html#ga7a6285db6617b68ae4946556c6a4636d" title="Ignore these settings.">AGL_DONTCARE</a>:
<a name="l00287"></a>00287 __allegro_gl_required_settings &= ~value;
<a name="l00288"></a>00288 __allegro_gl_suggested_settings &= ~value;
<a name="l00289"></a>00289 <span class="keywordflow">break</span>;
<a name="l00290"></a>00290
<a name="l00291"></a>00291 <span class="comment">/* Options configuring the mode set */</span>
<a name="l00292"></a>00292 <span class="keywordflow">case</span> <a class="code" href="group__settings.html#gab34e1290cbeb5fe252642f3bd59f0a52" title="Use Allegro-compatible framebuffer.">AGL_ALLEGRO_FORMAT</a>:
<a name="l00293"></a>00293 allegro_gl_display_info.allegro_format = value;
<a name="l00294"></a>00294 <span class="keywordflow">break</span>;
<a name="l00295"></a>00295 <span class="keywordflow">case</span> <a class="code" href="group__settings.html#gabe75eb7c907fedeef4763ad6c3ffd8f0" title="Select the red depth of the frame buffer.">AGL_RED_DEPTH</a>:
<a name="l00296"></a>00296 allegro_gl_display_info.pixel_size.rgba.r = value;
<a name="l00297"></a>00297 <span class="keywordflow">break</span>;
<a name="l00298"></a>00298 <span class="keywordflow">case</span> <a class="code" href="group__settings.html#gada8f8e9bb4e0ccf1bf7f7353d1e6032d" title="Select the green depth of the frame buffer.">AGL_GREEN_DEPTH</a>:
<a name="l00299"></a>00299 allegro_gl_display_info.pixel_size.rgba.g = value;
<a name="l00300"></a>00300 <span class="keywordflow">break</span>;
<a name="l00301"></a>00301 <span class="keywordflow">case</span> <a class="code" href="group__settings.html#ga8efacc076a3d6523dd989211833c1ca8" title="Select the blue depth of the frame buffer.">AGL_BLUE_DEPTH</a>:
<a name="l00302"></a>00302 allegro_gl_display_info.pixel_size.rgba.b = value;
<a name="l00303"></a>00303 <span class="keywordflow">break</span>;
<a name="l00304"></a>00304 <span class="keywordflow">case</span> <a class="code" href="group__settings.html#gad37b2a655ca53a34bb41bc629c8aa51e" title="Select the alpha depth of the frame buffer.">AGL_ALPHA_DEPTH</a>:
<a name="l00305"></a>00305 allegro_gl_display_info.pixel_size.rgba.a = value;
<a name="l00306"></a>00306 <span class="keywordflow">break</span>;
<a name="l00307"></a>00307 <span class="keywordflow">case</span> <a class="code" href="group__settings.html#ga71846e567336fe02f8f063af1282ddc5" title="Specify the total color depth of the frame buffer.">AGL_COLOR_DEPTH</a>:
<a name="l00308"></a>00308 <span class="keywordflow">switch</span> (value) {
<a name="l00309"></a>00309 <span class="keywordflow">case</span> 8:
<a name="l00310"></a>00310 <a class="code" href="group__settings.html#ga025e79a4394803a0e15aaf07b1a8a656" title="Sets a configuration option.">allegro_gl_set</a>(<a class="code" href="group__settings.html#gabe75eb7c907fedeef4763ad6c3ffd8f0" title="Select the red depth of the frame buffer.">AGL_RED_DEPTH</a>, 3);
<a name="l00311"></a>00311 <a class="code" href="group__settings.html#ga025e79a4394803a0e15aaf07b1a8a656" title="Sets a configuration option.">allegro_gl_set</a>(<a class="code" href="group__settings.html#gada8f8e9bb4e0ccf1bf7f7353d1e6032d" title="Select the green depth of the frame buffer.">AGL_GREEN_DEPTH</a>, 3);
<a name="l00312"></a>00312 <a class="code" href="group__settings.html#ga025e79a4394803a0e15aaf07b1a8a656" title="Sets a configuration option.">allegro_gl_set</a>(<a class="code" href="group__settings.html#ga8efacc076a3d6523dd989211833c1ca8" title="Select the blue depth of the frame buffer.">AGL_BLUE_DEPTH</a>, 2);
<a name="l00313"></a>00313 <a class="code" href="group__settings.html#ga025e79a4394803a0e15aaf07b1a8a656" title="Sets a configuration option.">allegro_gl_set</a>(<a class="code" href="group__settings.html#gad37b2a655ca53a34bb41bc629c8aa51e" title="Select the alpha depth of the frame buffer.">AGL_ALPHA_DEPTH</a>, 0);
<a name="l00314"></a>00314 <span class="keywordflow">break</span>;
<a name="l00315"></a>00315 <span class="keywordflow">case</span> 15:
<a name="l00316"></a>00316 <a class="code" href="group__settings.html#ga025e79a4394803a0e15aaf07b1a8a656" title="Sets a configuration option.">allegro_gl_set</a>(<a class="code" href="group__settings.html#gabe75eb7c907fedeef4763ad6c3ffd8f0" title="Select the red depth of the frame buffer.">AGL_RED_DEPTH</a>, 5);
<a name="l00317"></a>00317 <a class="code" href="group__settings.html#ga025e79a4394803a0e15aaf07b1a8a656" title="Sets a configuration option.">allegro_gl_set</a>(<a class="code" href="group__settings.html#gada8f8e9bb4e0ccf1bf7f7353d1e6032d" title="Select the green depth of the frame buffer.">AGL_GREEN_DEPTH</a>, 5);
<a name="l00318"></a>00318 <a class="code" href="group__settings.html#ga025e79a4394803a0e15aaf07b1a8a656" title="Sets a configuration option.">allegro_gl_set</a>(<a class="code" href="group__settings.html#ga8efacc076a3d6523dd989211833c1ca8" title="Select the blue depth of the frame buffer.">AGL_BLUE_DEPTH</a>, 5);
<a name="l00319"></a>00319 <a class="code" href="group__settings.html#ga025e79a4394803a0e15aaf07b1a8a656" title="Sets a configuration option.">allegro_gl_set</a>(<a class="code" href="group__settings.html#gad37b2a655ca53a34bb41bc629c8aa51e" title="Select the alpha depth of the frame buffer.">AGL_ALPHA_DEPTH</a>, 1);
<a name="l00320"></a>00320 <span class="keywordflow">break</span>;
<a name="l00321"></a>00321 <span class="keywordflow">case</span> 16:
<a name="l00322"></a>00322 <a class="code" href="group__settings.html#ga025e79a4394803a0e15aaf07b1a8a656" title="Sets a configuration option.">allegro_gl_set</a>(<a class="code" href="group__settings.html#gabe75eb7c907fedeef4763ad6c3ffd8f0" title="Select the red depth of the frame buffer.">AGL_RED_DEPTH</a>, 5);
<a name="l00323"></a>00323 <a class="code" href="group__settings.html#ga025e79a4394803a0e15aaf07b1a8a656" title="Sets a configuration option.">allegro_gl_set</a>(<a class="code" href="group__settings.html#gada8f8e9bb4e0ccf1bf7f7353d1e6032d" title="Select the green depth of the frame buffer.">AGL_GREEN_DEPTH</a>, 6);
<a name="l00324"></a>00324 <a class="code" href="group__settings.html#ga025e79a4394803a0e15aaf07b1a8a656" title="Sets a configuration option.">allegro_gl_set</a>(<a class="code" href="group__settings.html#ga8efacc076a3d6523dd989211833c1ca8" title="Select the blue depth of the frame buffer.">AGL_BLUE_DEPTH</a>, 5);
<a name="l00325"></a>00325 <a class="code" href="group__settings.html#ga025e79a4394803a0e15aaf07b1a8a656" title="Sets a configuration option.">allegro_gl_set</a>(<a class="code" href="group__settings.html#gad37b2a655ca53a34bb41bc629c8aa51e" title="Select the alpha depth of the frame buffer.">AGL_ALPHA_DEPTH</a>, 0);
<a name="l00326"></a>00326 <span class="keywordflow">break</span>;
<a name="l00327"></a>00327 <span class="keywordflow">case</span> 24:
<a name="l00328"></a>00328 <span class="keywordflow">case</span> 32:
<a name="l00329"></a>00329 <a class="code" href="group__settings.html#ga025e79a4394803a0e15aaf07b1a8a656" title="Sets a configuration option.">allegro_gl_set</a>(<a class="code" href="group__settings.html#gabe75eb7c907fedeef4763ad6c3ffd8f0" title="Select the red depth of the frame buffer.">AGL_RED_DEPTH</a>, 8);
<a name="l00330"></a>00330 <a class="code" href="group__settings.html#ga025e79a4394803a0e15aaf07b1a8a656" title="Sets a configuration option.">allegro_gl_set</a>(<a class="code" href="group__settings.html#gada8f8e9bb4e0ccf1bf7f7353d1e6032d" title="Select the green depth of the frame buffer.">AGL_GREEN_DEPTH</a>, 8);
<a name="l00331"></a>00331 <a class="code" href="group__settings.html#ga025e79a4394803a0e15aaf07b1a8a656" title="Sets a configuration option.">allegro_gl_set</a>(<a class="code" href="group__settings.html#ga8efacc076a3d6523dd989211833c1ca8" title="Select the blue depth of the frame buffer.">AGL_BLUE_DEPTH</a>, 8);
<a name="l00332"></a>00332 <a class="code" href="group__settings.html#ga025e79a4394803a0e15aaf07b1a8a656" title="Sets a configuration option.">allegro_gl_set</a>(<a class="code" href="group__settings.html#gad37b2a655ca53a34bb41bc629c8aa51e" title="Select the alpha depth of the frame buffer.">AGL_ALPHA_DEPTH</a>, value-24);
<a name="l00333"></a>00333 <span class="keywordflow">break</span>;
<a name="l00334"></a>00334 }
<a name="l00335"></a>00335 allegro_gl_display_info.colour_depth = value;
<a name="l00336"></a>00336 <span class="keywordflow">break</span>;
<a name="l00337"></a>00337 <span class="keywordflow">case</span> <a class="code" href="group__settings.html#ga317622005a4a2956a0d1659d3c47822a" title="Select the red depth of the accumulator buffer.">AGL_ACC_RED_DEPTH</a>:
<a name="l00338"></a>00338 allegro_gl_display_info.accum_size.rgba.r = value;
<a name="l00339"></a>00339 <span class="keywordflow">break</span>;
<a name="l00340"></a>00340 <span class="keywordflow">case</span> <a class="code" href="group__settings.html#ga00f4cfb4cb19b60d677b6941fec903ba" title="Select the green depth of the accumulator buffer.">AGL_ACC_GREEN_DEPTH</a>:
<a name="l00341"></a>00341 allegro_gl_display_info.accum_size.rgba.g = value;
<a name="l00342"></a>00342 <span class="keywordflow">break</span>;
<a name="l00343"></a>00343 <span class="keywordflow">case</span> <a class="code" href="group__settings.html#gaf80c6da60114ac3962aabcfd8745b97e" title="Select the blue depth of the accumulator buffer.">AGL_ACC_BLUE_DEPTH</a>:
<a name="l00344"></a>00344 allegro_gl_display_info.accum_size.rgba.b = value;
<a name="l00345"></a>00345 <span class="keywordflow">break</span>;
<a name="l00346"></a>00346 <span class="keywordflow">case</span> <a class="code" href="group__settings.html#gab8eba4f52cdb3d333b237c0ab0b3594a" title="Select the alpha depth of the accumulator buffer.">AGL_ACC_ALPHA_DEPTH</a>:
<a name="l00347"></a>00347 allegro_gl_display_info.accum_size.rgba.a = value;
<a name="l00348"></a>00348 <span class="keywordflow">break</span>;
<a name="l00349"></a>00349
<a name="l00350"></a>00350 <span class="keywordflow">case</span> <a class="code" href="group__settings.html#gaa1150ae35d6ff9b33d5771f29f9770dd" title="Creates a backbuffer if set.">AGL_DOUBLEBUFFER</a>:
<a name="l00351"></a>00351 allegro_gl_display_info.doublebuffered = value;
<a name="l00352"></a>00352 <span class="keywordflow">break</span>;
<a name="l00353"></a>00353 <span class="keywordflow">case</span> <a class="code" href="group__settings.html#ga47be892718fa4b2c6166caf51da67489" title="Creates seperate left/right buffers for stereo display.">AGL_STEREO</a>:
<a name="l00354"></a>00354 allegro_gl_display_info.stereo = value;
<a name="l00355"></a>00355 <span class="keywordflow">break</span>;
<a name="l00356"></a>00356 <span class="keywordflow">case</span> <a class="code" href="group__settings.html#ga6267cbe7841d12c35d59032f66b7b871" title="Creates additional auxiliary buffers.">AGL_AUX_BUFFERS</a>:
<a name="l00357"></a>00357 allegro_gl_display_info.aux_buffers = value;
<a name="l00358"></a>00358 <span class="keywordflow">break</span>;
<a name="l00359"></a>00359 <span class="keywordflow">case</span> <a class="code" href="group__settings.html#gabef24a727709a823e8fc900fdb72892e" title="Select the depth of the z-buffer.">AGL_Z_DEPTH</a>:
<a name="l00360"></a>00360 allegro_gl_display_info.depth_size = value;
<a name="l00361"></a>00361 <span class="keywordflow">break</span>;
<a name="l00362"></a>00362 <span class="keywordflow">case</span> <a class="code" href="group__settings.html#ga7b34772508e08edb0436e85d2d696fb9" title="Select the depth of the stencil buffer.">AGL_STENCIL_DEPTH</a>:
<a name="l00363"></a>00363 allegro_gl_display_info.stencil_size = value;
<a name="l00364"></a>00364 <span class="keywordflow">break</span>;
<a name="l00365"></a>00365
<a name="l00366"></a>00366 <span class="keywordflow">case</span> <a class="code" href="group__settings.html#gafea8132efd1fcac7a7f997ef0fe34cfa" title="Requests a placement of the window to a specified pixel location.">AGL_WINDOW_X</a>:
<a name="l00367"></a>00367 allegro_gl_display_info.x = value;
<a name="l00368"></a>00368 <span class="keywordflow">break</span>;
<a name="l00369"></a>00369 <span class="keywordflow">case</span> <a class="code" href="group__settings.html#ga80b7ef911d06ddee6d94d528cc6d914a" title="Same as AGL_WINDOW_X, but for the y-axis.">AGL_WINDOW_Y</a>:
<a name="l00370"></a>00370 allegro_gl_display_info.y = value;
<a name="l00371"></a>00371 <span class="keywordflow">break</span>;
<a name="l00372"></a>00372
<a name="l00373"></a>00373 <span class="keywordflow">case</span> <a class="code" href="group__settings.html#ga3cd047a464c8f8d928f9529226a4cf12" title="Set it if you&#39;d like AllegroGL to pay special attention on whether hardware acceleration is prese...">AGL_RENDERMETHOD</a>:
<a name="l00374"></a>00374 allegro_gl_display_info.rmethod = value;
<a name="l00375"></a>00375 <span class="keywordflow">break</span>;
<a name="l00376"></a>00376
<a name="l00377"></a>00377 <span class="keywordflow">case</span> <a class="code" href="group__settings.html#ga1baffefcedaffebf7ca47724a0441e60" title="Set if you&#39;d like a full screen mode.">AGL_FULLSCREEN</a>:
<a name="l00378"></a>00378 allegro_gl_display_info.fullscreen = value;
<a name="l00379"></a>00379 <span class="keywordflow">break</span>;
<a name="l00380"></a>00380
<a name="l00381"></a>00381 <span class="keywordflow">case</span> <a class="code" href="group__settings.html#ga6fcfd5d01183e704595b05fa9812b94f" title="Set if you&#39;d like a windowed mode.">AGL_WINDOWED</a>:
<a name="l00382"></a>00382 allegro_gl_display_info.fullscreen = !value;
<a name="l00383"></a>00383 <span class="keywordflow">break</span>;
<a name="l00384"></a>00384 <span class="keywordflow">case</span> <a class="code" href="group__settings.html#gab78a9c8ca24294b008d706a409c4fa37" title="Define AllegroGL&#39;s policy relative to video memory usage.">AGL_VIDEO_MEMORY_POLICY</a>:
<a name="l00385"></a>00385 <span class="keywordflow">if</span> ((value == <a class="code" href="group__settings.html#ga5deef983a0f5b2704746d7945c614b7c" title="Keep internal texture in video memory.">AGL_KEEP</a>) || (value == <a class="code" href="group__settings.html#ga77a6cb708e52f68f893128db6f20bdea" title="Release video memory occupied by internal texture.">AGL_RELEASE</a>))
<a name="l00386"></a>00386 allegro_gl_display_info.vidmem_policy = value;
<a name="l00387"></a>00387 <span class="keywordflow">break</span>;
<a name="l00388"></a>00388 <span class="keywordflow">case</span> <a class="code" href="group__settings.html#gae1836cab58a366c122ace31160fe0e06" title="Define multisample parameters Some OpenGL ICDs expose an extension called GL_ARB_multisample which pr...">AGL_SAMPLE_BUFFERS</a>:
<a name="l00389"></a>00389 allegro_gl_display_info.sample_buffers = value;
<a name="l00390"></a>00390 <span class="keywordflow">break</span>;
<a name="l00391"></a>00391 <span class="keywordflow">case</span> <a class="code" href="group__settings.html#ga92d9751c38774297013087e89a25749d" title="Define multisample samples Set this value to the number of samples that can be accepted in the multis...">AGL_SAMPLES</a>:
<a name="l00392"></a>00392 allegro_gl_display_info.samples = value;
<a name="l00393"></a>00393 <span class="keywordflow">break</span>;
<a name="l00394"></a>00394 <span class="keywordflow">case</span> <a class="code" href="group__settings.html#gafeffd285319ab06291f90d03ff8b2482" title="Floating-point Color buffer.">AGL_FLOAT_COLOR</a>:
<a name="l00395"></a>00395 allegro_gl_display_info.float_color = value;
<a name="l00396"></a>00396 <span class="keywordflow">break</span>;
<a name="l00397"></a>00397 <span class="keywordflow">case</span> <a class="code" href="group__settings.html#ga468710b6f682956d724f984ab7fa8e02" title="Floating-point Depth buffer.">AGL_FLOAT_Z</a>:
<a name="l00398"></a>00398 allegro_gl_display_info.float_depth = value;
<a name="l00399"></a>00399 <span class="keywordflow">break</span>;
<a name="l00400"></a>00400 }
<a name="l00401"></a>00401 }
<a name="l00402"></a>00402
<a name="l00403"></a>00403
<a name="l00404"></a>00404
<a name="l00421"></a><a class="code" href="group__settings.html#ga2179291ddb3cb528c3c0cf84af5c51a9">00421</a> <span class="keywordtype">int</span> <a class="code" href="group__settings.html#ga2179291ddb3cb528c3c0cf84af5c51a9" title="Reads the setting of a configuration option.">allegro_gl_get</a>(<span class="keywordtype">int</span> option)
<a name="l00422"></a>00422 {
<a name="l00423"></a>00423 <span class="keywordflow">switch</span> (option) {
<a name="l00424"></a>00424 <span class="comment">/* Options stating importance of other options */</span>
<a name="l00425"></a>00425 <span class="keywordflow">case</span> <a class="code" href="group__settings.html#ga839ae567340a64a97480e6abf1743b5f" title="Reject other values for these settings.">AGL_REQUIRE</a>:
<a name="l00426"></a>00426 <span class="keywordflow">return</span> __allegro_gl_required_settings;
<a name="l00427"></a>00427 <span class="keywordflow">case</span> <a class="code" href="group__settings.html#ga5a1518fe9c1b44beb7f5bdcc42b6b8f1" title="Prefer the assigned values for these settings.">AGL_SUGGEST</a>:
<a name="l00428"></a>00428 <span class="keywordflow">return</span> __allegro_gl_suggested_settings;
<a name="l00429"></a>00429 <span class="keywordflow">case</span> <a class="code" href="group__settings.html#ga7a6285db6617b68ae4946556c6a4636d" title="Ignore these settings.">AGL_DONTCARE</a>:
<a name="l00430"></a>00430 <span class="keywordflow">return</span> ~0 & ~(__allegro_gl_required_settings |
<a name="l00431"></a>00431 __allegro_gl_suggested_settings);
<a name="l00432"></a>00432
<a name="l00433"></a>00433 <span class="comment">/* Options configuring the mode set */</span>
<a name="l00434"></a>00434 <span class="keywordflow">case</span> <a class="code" href="group__settings.html#gab34e1290cbeb5fe252642f3bd59f0a52" title="Use Allegro-compatible framebuffer.">AGL_ALLEGRO_FORMAT</a>:
<a name="l00435"></a>00435 <span class="keywordflow">return</span> allegro_gl_display_info.allegro_format;
<a name="l00436"></a>00436 <span class="keywordflow">case</span> <a class="code" href="group__settings.html#gabe75eb7c907fedeef4763ad6c3ffd8f0" title="Select the red depth of the frame buffer.">AGL_RED_DEPTH</a>:
<a name="l00437"></a>00437 <span class="keywordflow">return</span> allegro_gl_display_info.pixel_size.rgba.r;
<a name="l00438"></a>00438 <span class="keywordflow">case</span> <a class="code" href="group__settings.html#gada8f8e9bb4e0ccf1bf7f7353d1e6032d" title="Select the green depth of the frame buffer.">AGL_GREEN_DEPTH</a>:
<a name="l00439"></a>00439 <span class="keywordflow">return</span> allegro_gl_display_info.pixel_size.rgba.g;
<a name="l00440"></a>00440 <span class="keywordflow">case</span> <a class="code" href="group__settings.html#ga8efacc076a3d6523dd989211833c1ca8" title="Select the blue depth of the frame buffer.">AGL_BLUE_DEPTH</a>:
<a name="l00441"></a>00441 <span class="keywordflow">return</span> allegro_gl_display_info.pixel_size.rgba.b;
<a name="l00442"></a>00442 <span class="keywordflow">case</span> <a class="code" href="group__settings.html#gad37b2a655ca53a34bb41bc629c8aa51e" title="Select the alpha depth of the frame buffer.">AGL_ALPHA_DEPTH</a>:
<a name="l00443"></a>00443 <span class="keywordflow">return</span> allegro_gl_display_info.pixel_size.rgba.a;
<a name="l00444"></a>00444 <span class="keywordflow">case</span> <a class="code" href="group__settings.html#ga71846e567336fe02f8f063af1282ddc5" title="Specify the total color depth of the frame buffer.">AGL_COLOR_DEPTH</a>:
<a name="l00445"></a>00445 <span class="keywordflow">return</span> allegro_gl_display_info.pixel_size.rgba.r
<a name="l00446"></a>00446 + allegro_gl_display_info.pixel_size.rgba.g
<a name="l00447"></a>00447 + allegro_gl_display_info.pixel_size.rgba.b
<a name="l00448"></a>00448 + allegro_gl_display_info.pixel_size.rgba.a;
<a name="l00449"></a>00449 <span class="keywordflow">case</span> <a class="code" href="group__settings.html#ga317622005a4a2956a0d1659d3c47822a" title="Select the red depth of the accumulator buffer.">AGL_ACC_RED_DEPTH</a>:
<a name="l00450"></a>00450 <span class="keywordflow">return</span> allegro_gl_display_info.accum_size.rgba.r;
<a name="l00451"></a>00451 <span class="keywordflow">case</span> <a class="code" href="group__settings.html#ga00f4cfb4cb19b60d677b6941fec903ba" title="Select the green depth of the accumulator buffer.">AGL_ACC_GREEN_DEPTH</a>:
<a name="l00452"></a>00452 <span class="keywordflow">return</span> allegro_gl_display_info.accum_size.rgba.g;
<a name="l00453"></a>00453 <span class="keywordflow">case</span> <a class="code" href="group__settings.html#gaf80c6da60114ac3962aabcfd8745b97e" title="Select the blue depth of the accumulator buffer.">AGL_ACC_BLUE_DEPTH</a>:
<a name="l00454"></a>00454 <span class="keywordflow">return</span> allegro_gl_display_info.accum_size.rgba.b;
<a name="l00455"></a>00455 <span class="keywordflow">case</span> <a class="code" href="group__settings.html#gab8eba4f52cdb3d333b237c0ab0b3594a" title="Select the alpha depth of the accumulator buffer.">AGL_ACC_ALPHA_DEPTH</a>:
<a name="l00456"></a>00456 <span class="keywordflow">return</span> allegro_gl_display_info.accum_size.rgba.a;
<a name="l00457"></a>00457 <span class="keywordflow">case</span> <a class="code" href="group__settings.html#gaa1150ae35d6ff9b33d5771f29f9770dd" title="Creates a backbuffer if set.">AGL_DOUBLEBUFFER</a>:
<a name="l00458"></a>00458 <span class="keywordflow">return</span> allegro_gl_display_info.doublebuffered;
<a name="l00459"></a>00459 <span class="keywordflow">case</span> <a class="code" href="group__settings.html#ga47be892718fa4b2c6166caf51da67489" title="Creates seperate left/right buffers for stereo display.">AGL_STEREO</a>:
<a name="l00460"></a>00460 <span class="keywordflow">return</span> allegro_gl_display_info.stereo;
<a name="l00461"></a>00461 <span class="keywordflow">case</span> <a class="code" href="group__settings.html#ga6267cbe7841d12c35d59032f66b7b871" title="Creates additional auxiliary buffers.">AGL_AUX_BUFFERS</a>:
<a name="l00462"></a>00462 <span class="keywordflow">return</span> allegro_gl_display_info.aux_buffers;
<a name="l00463"></a>00463 <span class="keywordflow">case</span> <a class="code" href="group__settings.html#gabef24a727709a823e8fc900fdb72892e" title="Select the depth of the z-buffer.">AGL_Z_DEPTH</a>:
<a name="l00464"></a>00464 <span class="keywordflow">return</span> allegro_gl_display_info.depth_size;
<a name="l00465"></a>00465 <span class="keywordflow">case</span> <a class="code" href="group__settings.html#ga7b34772508e08edb0436e85d2d696fb9" title="Select the depth of the stencil buffer.">AGL_STENCIL_DEPTH</a>:
<a name="l00466"></a>00466 <span class="keywordflow">return</span> allegro_gl_display_info.stencil_size;
<a name="l00467"></a>00467 <span class="keywordflow">case</span> <a class="code" href="group__settings.html#gafea8132efd1fcac7a7f997ef0fe34cfa" title="Requests a placement of the window to a specified pixel location.">AGL_WINDOW_X</a>:
<a name="l00468"></a>00468 <span class="keywordflow">return</span> allegro_gl_display_info.x;
<a name="l00469"></a>00469 <span class="keywordflow">case</span> <a class="code" href="group__settings.html#ga80b7ef911d06ddee6d94d528cc6d914a" title="Same as AGL_WINDOW_X, but for the y-axis.">AGL_WINDOW_Y</a>:
<a name="l00470"></a>00470 <span class="keywordflow">return</span> allegro_gl_display_info.y;
<a name="l00471"></a>00471 <span class="keywordflow">case</span> <a class="code" href="group__settings.html#ga1baffefcedaffebf7ca47724a0441e60" title="Set if you&#39;d like a full screen mode.">AGL_FULLSCREEN</a>:
<a name="l00472"></a>00472 <span class="keywordflow">return</span> allegro_gl_display_info.fullscreen;
<a name="l00473"></a>00473 <span class="keywordflow">case</span> <a class="code" href="group__settings.html#ga6fcfd5d01183e704595b05fa9812b94f" title="Set if you&#39;d like a windowed mode.">AGL_WINDOWED</a>:
<a name="l00474"></a>00474 <span class="keywordflow">return</span> !allegro_gl_display_info.fullscreen;
<a name="l00475"></a>00475 <span class="keywordflow">case</span> <a class="code" href="group__settings.html#gab78a9c8ca24294b008d706a409c4fa37" title="Define AllegroGL&#39;s policy relative to video memory usage.">AGL_VIDEO_MEMORY_POLICY</a>:
<a name="l00476"></a>00476 <span class="keywordflow">return</span> allegro_gl_display_info.vidmem_policy;
<a name="l00477"></a>00477 <span class="keywordflow">case</span> <a class="code" href="group__settings.html#gae1836cab58a366c122ace31160fe0e06" title="Define multisample parameters Some OpenGL ICDs expose an extension called GL_ARB_multisample which pr...">AGL_SAMPLE_BUFFERS</a>:
<a name="l00478"></a>00478 <span class="keywordflow">return</span> allegro_gl_display_info.sample_buffers;
<a name="l00479"></a>00479 <span class="keywordflow">case</span> <a class="code" href="group__settings.html#ga92d9751c38774297013087e89a25749d" title="Define multisample samples Set this value to the number of samples that can be accepted in the multis...">AGL_SAMPLES</a>:
<a name="l00480"></a>00480 <span class="keywordflow">return</span> allegro_gl_display_info.samples;
<a name="l00481"></a>00481 <span class="keywordflow">case</span> <a class="code" href="group__settings.html#gafeffd285319ab06291f90d03ff8b2482" title="Floating-point Color buffer.">AGL_FLOAT_COLOR</a>:
<a name="l00482"></a>00482 <span class="keywordflow">return</span> allegro_gl_display_info.float_color;
<a name="l00483"></a>00483 <span class="keywordflow">case</span> <a class="code" href="group__settings.html#ga468710b6f682956d724f984ab7fa8e02" title="Floating-point Depth buffer.">AGL_FLOAT_Z</a>:
<a name="l00484"></a>00484 <span class="keywordflow">return</span> allegro_gl_display_info.float_depth;
<a name="l00485"></a>00485 }
<a name="l00486"></a>00486 <span class="keywordflow">return</span> -1;
<a name="l00487"></a>00487 }
<a name="l00488"></a>00488
<a name="l00489"></a>00489
<a name="l00490"></a>00490
<a name="l00491"></a>00491 <span class="comment">/* Builds a string corresponding to the options set in 'opt'</span>
<a name="l00492"></a>00492 <span class="comment"> * and writes in the config file</span>
<a name="l00493"></a>00493 <span class="comment"> */</span>
<a name="l00494"></a>00494 <span class="keyword">static</span> <span class="keywordtype">void</span> build_settings(<span class="keywordtype">int</span> opt, <span class="keywordtype">char</span> *section, <span class="keywordtype">char</span> *name) {
<a name="l00495"></a>00495 <span class="keywordtype">char</span> buf[2048];
<a name="l00496"></a>00496
<a name="l00497"></a>00497 usetc(buf, 0);
<a name="l00498"></a>00498
<a name="l00499"></a>00499 <span class="keywordflow">if</span> (opt & <a class="code" href="group__settings.html#gab34e1290cbeb5fe252642f3bd59f0a52" title="Use Allegro-compatible framebuffer.">AGL_ALLEGRO_FORMAT</a>)
<a name="l00500"></a>00500 ustrcat(buf, <span class="stringliteral">"allegro_format "</span>);
<a name="l00501"></a>00501 <span class="keywordflow">if</span> (opt & <a class="code" href="group__settings.html#gabe75eb7c907fedeef4763ad6c3ffd8f0" title="Select the red depth of the frame buffer.">AGL_RED_DEPTH</a>)
<a name="l00502"></a>00502 ustrcat(buf, <span class="stringliteral">"red_depth "</span>);
<a name="l00503"></a>00503 <span class="keywordflow">if</span> (opt & <a class="code" href="group__settings.html#gada8f8e9bb4e0ccf1bf7f7353d1e6032d" title="Select the green depth of the frame buffer.">AGL_GREEN_DEPTH</a>)
<a name="l00504"></a>00504 ustrcat(buf, <span class="stringliteral">"green_depth "</span>);
<a name="l00505"></a>00505 <span class="keywordflow">if</span> (opt & <a class="code" href="group__settings.html#ga8efacc076a3d6523dd989211833c1ca8" title="Select the blue depth of the frame buffer.">AGL_BLUE_DEPTH</a>)
<a name="l00506"></a>00506 ustrcat(buf, <span class="stringliteral">"blue_depth "</span>);
<a name="l00507"></a>00507 <span class="keywordflow">if</span> (opt & <a class="code" href="group__settings.html#gad37b2a655ca53a34bb41bc629c8aa51e" title="Select the alpha depth of the frame buffer.">AGL_ALPHA_DEPTH</a>)
<a name="l00508"></a>00508 ustrcat(buf, <span class="stringliteral">"alpha_depth "</span>);
<a name="l00509"></a>00509 <span class="keywordflow">if</span> (opt & <a class="code" href="group__settings.html#ga71846e567336fe02f8f063af1282ddc5" title="Specify the total color depth of the frame buffer.">AGL_COLOR_DEPTH</a>)
<a name="l00510"></a>00510 ustrcat(buf, <span class="stringliteral">"color_depth "</span>);
<a name="l00511"></a>00511 <span class="keywordflow">if</span> (opt & <a class="code" href="group__settings.html#ga317622005a4a2956a0d1659d3c47822a" title="Select the red depth of the accumulator buffer.">AGL_ACC_RED_DEPTH</a>)
<a name="l00512"></a>00512 ustrcat(buf, <span class="stringliteral">"accum_red_depth "</span>);
<a name="l00513"></a>00513 <span class="keywordflow">if</span> (opt & <a class="code" href="group__settings.html#ga00f4cfb4cb19b60d677b6941fec903ba" title="Select the green depth of the accumulator buffer.">AGL_ACC_GREEN_DEPTH</a>)
<a name="l00514"></a>00514 ustrcat(buf, <span class="stringliteral">"accum_green_depth "</span>);
<a name="l00515"></a>00515 <span class="keywordflow">if</span> (opt & <a class="code" href="group__settings.html#gaf80c6da60114ac3962aabcfd8745b97e" title="Select the blue depth of the accumulator buffer.">AGL_ACC_BLUE_DEPTH</a>)
<a name="l00516"></a>00516 ustrcat(buf, <span class="stringliteral">"accum_blue_depth "</span>);
<a name="l00517"></a>00517 <span class="keywordflow">if</span> (opt & <a class="code" href="group__settings.html#gab8eba4f52cdb3d333b237c0ab0b3594a" title="Select the alpha depth of the accumulator buffer.">AGL_ACC_ALPHA_DEPTH</a>)
<a name="l00518"></a>00518 ustrcat(buf, <span class="stringliteral">"accum_alpha_depth "</span>);
<a name="l00519"></a>00519 <span class="keywordflow">if</span> (opt & <a class="code" href="group__settings.html#gaa1150ae35d6ff9b33d5771f29f9770dd" title="Creates a backbuffer if set.">AGL_DOUBLEBUFFER</a>)
<a name="l00520"></a>00520 ustrcat(buf, <span class="stringliteral">"double_buffer "</span>);
<a name="l00521"></a>00521 <span class="keywordflow">if</span> (opt & <a class="code" href="group__settings.html#ga47be892718fa4b2c6166caf51da67489" title="Creates seperate left/right buffers for stereo display.">AGL_STEREO</a>)
<a name="l00522"></a>00522 ustrcat(buf, <span class="stringliteral">"stereo_display "</span>);
<a name="l00523"></a>00523 <span class="keywordflow">if</span> (opt & <a class="code" href="group__settings.html#ga6267cbe7841d12c35d59032f66b7b871" title="Creates additional auxiliary buffers.">AGL_AUX_BUFFERS</a>)
<a name="l00524"></a>00524 ustrcat(buf, <span class="stringliteral">"aux_buffers "</span>);
<a name="l00525"></a>00525 <span class="keywordflow">if</span> (opt & <a class="code" href="group__settings.html#gabef24a727709a823e8fc900fdb72892e" title="Select the depth of the z-buffer.">AGL_Z_DEPTH</a>)
<a name="l00526"></a>00526 ustrcat(buf, <span class="stringliteral">"z_depth "</span>);
<a name="l00527"></a>00527 <span class="keywordflow">if</span> (opt & <a class="code" href="group__settings.html#ga7b34772508e08edb0436e85d2d696fb9" title="Select the depth of the stencil buffer.">AGL_STENCIL_DEPTH</a>)
<a name="l00528"></a>00528 ustrcat(buf, <span class="stringliteral">"stencil_depth "</span>);
<a name="l00529"></a>00529 <span class="keywordflow">if</span> (opt & <a class="code" href="group__settings.html#gafea8132efd1fcac7a7f997ef0fe34cfa" title="Requests a placement of the window to a specified pixel location.">AGL_WINDOW_X</a>)
<a name="l00530"></a>00530 ustrcat(buf, <span class="stringliteral">"window_x "</span>);
<a name="l00531"></a>00531 <span class="keywordflow">if</span> (opt & <a class="code" href="group__settings.html#ga80b7ef911d06ddee6d94d528cc6d914a" title="Same as AGL_WINDOW_X, but for the y-axis.">AGL_WINDOW_Y</a>)
<a name="l00532"></a>00532 ustrcat(buf, <span class="stringliteral">"window_y "</span>);
<a name="l00533"></a>00533 <span class="keywordflow">if</span> (opt & <a class="code" href="group__settings.html#ga1baffefcedaffebf7ca47724a0441e60" title="Set if you&#39;d like a full screen mode.">AGL_FULLSCREEN</a>)
<a name="l00534"></a>00534 ustrcat(buf, <span class="stringliteral">"fullscreen "</span>);
<a name="l00535"></a>00535 <span class="keywordflow">if</span> (opt & <a class="code" href="group__settings.html#ga6fcfd5d01183e704595b05fa9812b94f" title="Set if you&#39;d like a windowed mode.">AGL_WINDOWED</a>)
<a name="l00536"></a>00536 ustrcat(buf, <span class="stringliteral">"windowed "</span>);
<a name="l00537"></a>00537 <span class="keywordflow">if</span> (opt & <a class="code" href="group__settings.html#gab78a9c8ca24294b008d706a409c4fa37" title="Define AllegroGL&#39;s policy relative to video memory usage.">AGL_VIDEO_MEMORY_POLICY</a>)
<a name="l00538"></a>00538 ustrcat(buf, <span class="stringliteral">"video_memory_policy "</span>);
<a name="l00539"></a>00539 <span class="keywordflow">if</span> (opt & <a class="code" href="group__settings.html#gae1836cab58a366c122ace31160fe0e06" title="Define multisample parameters Some OpenGL ICDs expose an extension called GL_ARB_multisample which pr...">AGL_SAMPLE_BUFFERS</a>)
<a name="l00540"></a>00540 ustrcat(buf, <span class="stringliteral">"sample_buffers "</span>);
<a name="l00541"></a>00541 <span class="keywordflow">if</span> (opt & <a class="code" href="group__settings.html#ga92d9751c38774297013087e89a25749d" title="Define multisample samples Set this value to the number of samples that can be accepted in the multis...">AGL_SAMPLES</a>)
<a name="l00542"></a>00542 ustrcat(buf, <span class="stringliteral">"samples "</span>);
<a name="l00543"></a>00543 <span class="keywordflow">if</span> (opt & <a class="code" href="group__settings.html#gafeffd285319ab06291f90d03ff8b2482" title="Floating-point Color buffer.">AGL_FLOAT_COLOR</a>)
<a name="l00544"></a>00544 ustrcat(buf, <span class="stringliteral">"float_color "</span>);
<a name="l00545"></a>00545 <span class="keywordflow">if</span> (opt & <a class="code" href="group__settings.html#ga468710b6f682956d724f984ab7fa8e02" title="Floating-point Depth buffer.">AGL_FLOAT_Z</a>)
<a name="l00546"></a>00546 ustrcat(buf, <span class="stringliteral">"float_depth "</span>);
<a name="l00547"></a>00547
<a name="l00548"></a>00548 set_config_string(section, name, buf);
<a name="l00549"></a>00549 }
<a name="l00550"></a>00550
<a name="l00551"></a>00551
<a name="l00552"></a>00552
<a name="l00553"></a>00553 <span class="comment">/* void allegro_gl_save_settings() */</span>
<a name="l00560"></a><a class="code" href="group__settings.html#gaa461b9459f56c9274d2d49accf201ee1">00560</a> <span class="keywordtype">void</span> <a class="code" href="group__settings.html#gaa461b9459f56c9274d2d49accf201ee1" title="Saves the current settings (as specified by allegro_gl_set()) to the current config file...">allegro_gl_save_settings</a>() {
<a name="l00561"></a>00561
<a name="l00562"></a>00562 <span class="keywordtype">char</span> *section = <span class="stringliteral">"OpenGL"</span>;
<a name="l00563"></a>00563 <span class="keywordtype">int</span> save = <a class="code" href="group__settings.html#ga2179291ddb3cb528c3c0cf84af5c51a9" title="Reads the setting of a configuration option.">allegro_gl_get</a>(<a class="code" href="group__settings.html#ga839ae567340a64a97480e6abf1743b5f" title="Reject other values for these settings.">AGL_REQUIRE</a>) | <a class="code" href="group__settings.html#ga2179291ddb3cb528c3c0cf84af5c51a9" title="Reads the setting of a configuration option.">allegro_gl_get</a>(<a class="code" href="group__settings.html#ga5a1518fe9c1b44beb7f5bdcc42b6b8f1" title="Prefer the assigned values for these settings.">AGL_SUGGEST</a>);
<a name="l00564"></a>00564
<a name="l00565"></a>00565 <span class="keywordflow">if</span> (save & AGL_ALLEGRO_FORMAT)
<a name="l00566"></a>00566 set_config_int(section, <span class="stringliteral">"allegro_format"</span>,
<a name="l00567"></a>00567 <a class="code" href="group__settings.html#ga2179291ddb3cb528c3c0cf84af5c51a9" title="Reads the setting of a configuration option.">allegro_gl_get</a>(AGL_ALLEGRO_FORMAT));
<a name="l00568"></a>00568 <span class="keywordflow">if</span> (save & AGL_RED_DEPTH)
<a name="l00569"></a>00569 set_config_int(section, <span class="stringliteral">"red_depth"</span>,
<a name="l00570"></a>00570 <a class="code" href="group__settings.html#ga2179291ddb3cb528c3c0cf84af5c51a9" title="Reads the setting of a configuration option.">allegro_gl_get</a>(AGL_RED_DEPTH));
<a name="l00571"></a>00571 <span class="keywordflow">if</span> (save & AGL_GREEN_DEPTH)
<a name="l00572"></a>00572 set_config_int(section, <span class="stringliteral">"green_depth"</span>,
<a name="l00573"></a>00573 <a class="code" href="group__settings.html#ga2179291ddb3cb528c3c0cf84af5c51a9" title="Reads the setting of a configuration option.">allegro_gl_get</a>(AGL_GREEN_DEPTH));
<a name="l00574"></a>00574 <span class="keywordflow">if</span> (save & AGL_BLUE_DEPTH)
<a name="l00575"></a>00575 set_config_int(section, <span class="stringliteral">"blue_depth"</span>,
<a name="l00576"></a>00576 <a class="code" href="group__settings.html#ga2179291ddb3cb528c3c0cf84af5c51a9" title="Reads the setting of a configuration option.">allegro_gl_get</a>(AGL_BLUE_DEPTH));
<a name="l00577"></a>00577 <span class="keywordflow">if</span> (save & AGL_ALPHA_DEPTH)
<a name="l00578"></a>00578 set_config_int(section, <span class="stringliteral">"alpha_depth"</span>,
<a name="l00579"></a>00579 <a class="code" href="group__settings.html#ga2179291ddb3cb528c3c0cf84af5c51a9" title="Reads the setting of a configuration option.">allegro_gl_get</a>(AGL_ALPHA_DEPTH));
<a name="l00580"></a>00580 <span class="keywordflow">if</span> (save & AGL_COLOR_DEPTH)
<a name="l00581"></a>00581 set_config_int(section, <span class="stringliteral">"color_depth"</span>,
<a name="l00582"></a>00582 <a class="code" href="group__settings.html#ga2179291ddb3cb528c3c0cf84af5c51a9" title="Reads the setting of a configuration option.">allegro_gl_get</a>(AGL_COLOR_DEPTH));
<a name="l00583"></a>00583 <span class="keywordflow">if</span> (save & AGL_ACC_RED_DEPTH)
<a name="l00584"></a>00584 set_config_int(section, <span class="stringliteral">"accum_red_depth"</span>,
<a name="l00585"></a>00585 <a class="code" href="group__settings.html#ga2179291ddb3cb528c3c0cf84af5c51a9" title="Reads the setting of a configuration option.">allegro_gl_get</a>(AGL_ACC_RED_DEPTH));
<a name="l00586"></a>00586 <span class="keywordflow">if</span> (save & AGL_ACC_GREEN_DEPTH)
<a name="l00587"></a>00587 set_config_int(section, <span class="stringliteral">"accum_green_depth"</span>,
<a name="l00588"></a>00588 <a class="code" href="group__settings.html#ga2179291ddb3cb528c3c0cf84af5c51a9" title="Reads the setting of a configuration option.">allegro_gl_get</a>(AGL_ACC_GREEN_DEPTH));
<a name="l00589"></a>00589 <span class="keywordflow">if</span> (save & AGL_ACC_BLUE_DEPTH)
<a name="l00590"></a>00590 set_config_int(section, <span class="stringliteral">"accum_blue_depth"</span>,
<a name="l00591"></a>00591 <a class="code" href="group__settings.html#ga2179291ddb3cb528c3c0cf84af5c51a9" title="Reads the setting of a configuration option.">allegro_gl_get</a>(AGL_ACC_BLUE_DEPTH));
<a name="l00592"></a>00592 <span class="keywordflow">if</span> (save & AGL_ACC_ALPHA_DEPTH)
<a name="l00593"></a>00593 set_config_int(section, <span class="stringliteral">"accum_alpha_depth"</span>,
<a name="l00594"></a>00594 <a class="code" href="group__settings.html#ga2179291ddb3cb528c3c0cf84af5c51a9" title="Reads the setting of a configuration option.">allegro_gl_get</a>(AGL_ACC_ALPHA_DEPTH));
<a name="l00595"></a>00595 <span class="keywordflow">if</span> (save & AGL_DOUBLEBUFFER)
<a name="l00596"></a>00596 set_config_int(section, <span class="stringliteral">"double_buffer"</span>,
<a name="l00597"></a>00597 <a class="code" href="group__settings.html#ga2179291ddb3cb528c3c0cf84af5c51a9" title="Reads the setting of a configuration option.">allegro_gl_get</a>(AGL_DOUBLEBUFFER));
<a name="l00598"></a>00598 <span class="keywordflow">if</span> (save & AGL_STEREO)
<a name="l00599"></a>00599 set_config_int(section, <span class="stringliteral">"stereo_display"</span>,
<a name="l00600"></a>00600 <a class="code" href="group__settings.html#ga2179291ddb3cb528c3c0cf84af5c51a9" title="Reads the setting of a configuration option.">allegro_gl_get</a>(AGL_STEREO));
<a name="l00601"></a>00601 <span class="keywordflow">if</span> (save & AGL_AUX_BUFFERS)
<a name="l00602"></a>00602 set_config_int(section, <span class="stringliteral">"aux_buffers"</span>,
<a name="l00603"></a>00603 <a class="code" href="group__settings.html#ga2179291ddb3cb528c3c0cf84af5c51a9" title="Reads the setting of a configuration option.">allegro_gl_get</a>(AGL_AUX_BUFFERS));
<a name="l00604"></a>00604 <span class="keywordflow">if</span> (save & AGL_Z_DEPTH)
<a name="l00605"></a>00605 set_config_int(section, <span class="stringliteral">"z_depth"</span>,
<a name="l00606"></a>00606 <a class="code" href="group__settings.html#ga2179291ddb3cb528c3c0cf84af5c51a9" title="Reads the setting of a configuration option.">allegro_gl_get</a>(AGL_Z_DEPTH));
<a name="l00607"></a>00607 <span class="keywordflow">if</span> (save & AGL_STENCIL_DEPTH)
<a name="l00608"></a>00608 set_config_int(section, <span class="stringliteral">"stencil_depth"</span>,
<a name="l00609"></a>00609 <a class="code" href="group__settings.html#ga2179291ddb3cb528c3c0cf84af5c51a9" title="Reads the setting of a configuration option.">allegro_gl_get</a>(AGL_STENCIL_DEPTH));
<a name="l00610"></a>00610 <span class="keywordflow">if</span> (save & AGL_WINDOW_X)
<a name="l00611"></a>00611 set_config_int(section, <span class="stringliteral">"window_x"</span>,
<a name="l00612"></a>00612 <a class="code" href="group__settings.html#ga2179291ddb3cb528c3c0cf84af5c51a9" title="Reads the setting of a configuration option.">allegro_gl_get</a>(AGL_WINDOW_X));
<a name="l00613"></a>00613 <span class="keywordflow">if</span> (save & AGL_WINDOW_Y)
<a name="l00614"></a>00614 set_config_int(section, <span class="stringliteral">"window_y"</span>,
<a name="l00615"></a>00615 <a class="code" href="group__settings.html#ga2179291ddb3cb528c3c0cf84af5c51a9" title="Reads the setting of a configuration option.">allegro_gl_get</a>(AGL_WINDOW_Y));
<a name="l00616"></a>00616 <span class="keywordflow">if</span> (save & AGL_FULLSCREEN)
<a name="l00617"></a>00617 set_config_int(section, <span class="stringliteral">"fullscreen"</span>,
<a name="l00618"></a>00618 <a class="code" href="group__settings.html#ga2179291ddb3cb528c3c0cf84af5c51a9" title="Reads the setting of a configuration option.">allegro_gl_get</a>(AGL_FULLSCREEN));
<a name="l00619"></a>00619 <span class="keywordflow">if</span> (save & AGL_WINDOWED)
<a name="l00620"></a>00620 set_config_int(section, <span class="stringliteral">"windowed"</span>,
<a name="l00621"></a>00621 <a class="code" href="group__settings.html#ga2179291ddb3cb528c3c0cf84af5c51a9" title="Reads the setting of a configuration option.">allegro_gl_get</a>(AGL_WINDOWED));
<a name="l00622"></a>00622 <span class="keywordflow">if</span> (save & AGL_VIDEO_MEMORY_POLICY)
<a name="l00623"></a>00623 set_config_int(section, <span class="stringliteral">"video_memory_policy"</span>,
<a name="l00624"></a>00624 <a class="code" href="group__settings.html#ga2179291ddb3cb528c3c0cf84af5c51a9" title="Reads the setting of a configuration option.">allegro_gl_get</a>(AGL_VIDEO_MEMORY_POLICY));
<a name="l00625"></a>00625 <span class="keywordflow">if</span> (save & AGL_SAMPLE_BUFFERS)
<a name="l00626"></a>00626 set_config_int(section, <span class="stringliteral">"sample_buffers"</span>,
<a name="l00627"></a>00627 <a class="code" href="group__settings.html#ga2179291ddb3cb528c3c0cf84af5c51a9" title="Reads the setting of a configuration option.">allegro_gl_get</a>(AGL_SAMPLE_BUFFERS));
<a name="l00628"></a>00628 <span class="keywordflow">if</span> (save & AGL_SAMPLES)
<a name="l00629"></a>00629 set_config_int(section, <span class="stringliteral">"samples"</span>,
<a name="l00630"></a>00630 <a class="code" href="group__settings.html#ga2179291ddb3cb528c3c0cf84af5c51a9" title="Reads the setting of a configuration option.">allegro_gl_get</a>(AGL_SAMPLES));
<a name="l00631"></a>00631 <span class="keywordflow">if</span> (save & AGL_FLOAT_COLOR)
<a name="l00632"></a>00632 set_config_int(section, <span class="stringliteral">"float_color"</span>,
<a name="l00633"></a>00633 <a class="code" href="group__settings.html#ga2179291ddb3cb528c3c0cf84af5c51a9" title="Reads the setting of a configuration option.">allegro_gl_get</a>(AGL_FLOAT_COLOR));
<a name="l00634"></a>00634 <span class="keywordflow">if</span> (save & <a class="code" href="group__settings.html#ga468710b6f682956d724f984ab7fa8e02" title="Floating-point Depth buffer.">AGL_FLOAT_Z</a>)
<a name="l00635"></a>00635 set_config_int(section, <span class="stringliteral">"float_depth"</span>,
<a name="l00636"></a>00636 <a class="code" href="group__settings.html#ga2179291ddb3cb528c3c0cf84af5c51a9" title="Reads the setting of a configuration option.">allegro_gl_get</a>(AGL_FLOAT_Z));
<a name="l00637"></a>00637
<a name="l00638"></a>00638 <span class="keywordflow">if</span> (save & <a class="code" href="group__settings.html#ga839ae567340a64a97480e6abf1743b5f" title="Reject other values for these settings.">AGL_REQUIRE</a>)
<a name="l00639"></a>00639 build_settings(<a class="code" href="group__settings.html#ga2179291ddb3cb528c3c0cf84af5c51a9" title="Reads the setting of a configuration option.">allegro_gl_get</a>(AGL_REQUIRE), section, <span class="stringliteral">"require"</span>);
<a name="l00640"></a>00640 <span class="keywordflow">if</span> (save & <a class="code" href="group__settings.html#ga5a1518fe9c1b44beb7f5bdcc42b6b8f1" title="Prefer the assigned values for these settings.">AGL_SUGGEST</a>)
<a name="l00641"></a>00641 build_settings(<a class="code" href="group__settings.html#ga2179291ddb3cb528c3c0cf84af5c51a9" title="Reads the setting of a configuration option.">allegro_gl_get</a>(AGL_SUGGEST), section, <span class="stringliteral">"suggest"</span>);
<a name="l00642"></a>00642 }
<a name="l00643"></a>00643
<a name="l00644"></a>00644
<a name="l00645"></a>00645
<a name="l00646"></a>00646 <span class="comment">/* Parses an input string to read settings */</span>
<a name="l00647"></a>00647 <span class="keyword">static</span> <span class="keywordtype">void</span> agl_parse_section(<span class="keywordtype">int</span> sec, <span class="keywordtype">char</span> *section, <span class="keywordtype">char</span> *name) {
<a name="l00648"></a>00648 <span class="keyword">const</span> <span class="keywordtype">char</span> *end;
<a name="l00649"></a>00649 <span class="keywordtype">char</span> *buf;
<a name="l00650"></a>00650 <span class="keywordtype">char</span> *ptr;
<a name="l00651"></a>00651 <span class="keywordtype">int</span> strsize;
<a name="l00652"></a>00652 <span class="keywordtype">int</span> opt = 0;
<a name="l00653"></a>00653
<a name="l00654"></a>00654 end = get_config_string(section, name, <span class="stringliteral">""</span>);
<a name="l00655"></a>00655 strsize = ustrsizez(end);
<a name="l00656"></a>00656
<a name="l00657"></a>00657 buf = (<span class="keywordtype">char</span>*)malloc(<span class="keyword">sizeof</span>(<span class="keywordtype">char</span>) * strsize);
<a name="l00658"></a>00658
<a name="l00659"></a>00659 <span class="keywordflow">if</span> (!buf) {
<a name="l00660"></a>00660 TRACE(PREFIX_E <span class="stringliteral">"parse_section: Ran out of memory "</span>
<a name="l00661"></a>00661 <span class="stringliteral">"while trying to allocate %i bytes!"</span>,
<a name="l00662"></a>00662 (<span class="keywordtype">int</span>)<span class="keyword">sizeof</span>(<span class="keywordtype">char</span>) * strsize);
<a name="l00663"></a>00663 <span class="keywordflow">return</span>;
<a name="l00664"></a>00664 }
<a name="l00665"></a>00665
<a name="l00666"></a>00666 memcpy(buf, end, strsize);
<a name="l00667"></a>00667 end = buf + strsize;
<a name="l00668"></a>00668 ptr = buf;
<a name="l00669"></a>00669
<a name="l00670"></a>00670 <span class="keywordflow">while</span> (ptr < end) {
<a name="l00671"></a>00671 <span class="keywordtype">char</span> *s = ustrtok_r(ptr, <span class="stringliteral">" ;|+"</span>, &ptr);
<a name="l00672"></a>00672
<a name="l00673"></a>00673 <span class="keywordflow">if</span> (!ustrcmp(s, <span class="stringliteral">"allegro_format"</span>))
<a name="l00674"></a>00674 opt |= <a class="code" href="group__settings.html#gab34e1290cbeb5fe252642f3bd59f0a52" title="Use Allegro-compatible framebuffer.">AGL_ALLEGRO_FORMAT</a>;
<a name="l00675"></a>00675 <span class="keywordflow">if</span> (!ustrcmp(s, <span class="stringliteral">"red_depth"</span>))
<a name="l00676"></a>00676 opt |= <a class="code" href="group__settings.html#gabe75eb7c907fedeef4763ad6c3ffd8f0" title="Select the red depth of the frame buffer.">AGL_RED_DEPTH</a>;
<a name="l00677"></a>00677 <span class="keywordflow">if</span> (!ustrcmp(s, <span class="stringliteral">"green_depth"</span>))
<a name="l00678"></a>00678 opt |= <a class="code" href="group__settings.html#gada8f8e9bb4e0ccf1bf7f7353d1e6032d" title="Select the green depth of the frame buffer.">AGL_GREEN_DEPTH</a>;
<a name="l00679"></a>00679 <span class="keywordflow">if</span> (!ustrcmp(s, <span class="stringliteral">"blue_depth"</span>))
<a name="l00680"></a>00680 opt |= <a class="code" href="group__settings.html#ga8efacc076a3d6523dd989211833c1ca8" title="Select the blue depth of the frame buffer.">AGL_BLUE_DEPTH</a>;
<a name="l00681"></a>00681 <span class="keywordflow">if</span> (!ustrcmp(s, <span class="stringliteral">"alpha_depth"</span>))
<a name="l00682"></a>00682 opt |= <a class="code" href="group__settings.html#gad37b2a655ca53a34bb41bc629c8aa51e" title="Select the alpha depth of the frame buffer.">AGL_ALPHA_DEPTH</a>;
<a name="l00683"></a>00683 <span class="keywordflow">if</span> (!ustrcmp(s, <span class="stringliteral">"color_depth"</span>))
<a name="l00684"></a>00684 opt |= <a class="code" href="group__settings.html#ga71846e567336fe02f8f063af1282ddc5" title="Specify the total color depth of the frame buffer.">AGL_COLOR_DEPTH</a>;
<a name="l00685"></a>00685 <span class="keywordflow">if</span> (!ustrcmp(s, <span class="stringliteral">"accum_red_depth"</span>))
<a name="l00686"></a>00686 opt |= <a class="code" href="group__settings.html#ga317622005a4a2956a0d1659d3c47822a" title="Select the red depth of the accumulator buffer.">AGL_ACC_RED_DEPTH</a>;
<a name="l00687"></a>00687 <span class="keywordflow">if</span> (!ustrcmp(s, <span class="stringliteral">"accum_green_depth"</span>))
<a name="l00688"></a>00688 opt |= <a class="code" href="group__settings.html#ga00f4cfb4cb19b60d677b6941fec903ba" title="Select the green depth of the accumulator buffer.">AGL_ACC_GREEN_DEPTH</a>;
<a name="l00689"></a>00689 <span class="keywordflow">if</span> (!ustrcmp(s, <span class="stringliteral">"accum_blue_depth"</span>))
<a name="l00690"></a>00690 opt |= <a class="code" href="group__settings.html#gaf80c6da60114ac3962aabcfd8745b97e" title="Select the blue depth of the accumulator buffer.">AGL_ACC_BLUE_DEPTH</a>;
<a name="l00691"></a>00691 <span class="keywordflow">if</span> (!ustrcmp(s, <span class="stringliteral">"accum_alpha_depth"</span>))
<a name="l00692"></a>00692 opt |= <a class="code" href="group__settings.html#gab8eba4f52cdb3d333b237c0ab0b3594a" title="Select the alpha depth of the accumulator buffer.">AGL_ACC_ALPHA_DEPTH</a>;
<a name="l00693"></a>00693 <span class="keywordflow">if</span> (!ustrcmp(s, <span class="stringliteral">"double_buffer"</span>))
<a name="l00694"></a>00694 opt |= <a class="code" href="group__settings.html#gaa1150ae35d6ff9b33d5771f29f9770dd" title="Creates a backbuffer if set.">AGL_DOUBLEBUFFER</a>;
<a name="l00695"></a>00695 <span class="keywordflow">if</span> (!ustrcmp(s, <span class="stringliteral">"stereo_display"</span>))
<a name="l00696"></a>00696 opt |= <a class="code" href="group__settings.html#ga47be892718fa4b2c6166caf51da67489" title="Creates seperate left/right buffers for stereo display.">AGL_STEREO</a>;
<a name="l00697"></a>00697 <span class="keywordflow">if</span> (!ustrcmp(s, <span class="stringliteral">"aux_buffers"</span>))
<a name="l00698"></a>00698 opt |= <a class="code" href="group__settings.html#ga6267cbe7841d12c35d59032f66b7b871" title="Creates additional auxiliary buffers.">AGL_AUX_BUFFERS</a>;
<a name="l00699"></a>00699 <span class="keywordflow">if</span> (!ustrcmp(s, <span class="stringliteral">"z_depth"</span>))
<a name="l00700"></a>00700 opt |= <a class="code" href="group__settings.html#gabef24a727709a823e8fc900fdb72892e" title="Select the depth of the z-buffer.">AGL_Z_DEPTH</a>;
<a name="l00701"></a>00701 <span class="keywordflow">if</span> (!ustrcmp(s, <span class="stringliteral">"stencil_depth"</span>))
<a name="l00702"></a>00702 opt |= <a class="code" href="group__settings.html#ga7b34772508e08edb0436e85d2d696fb9" title="Select the depth of the stencil buffer.">AGL_STENCIL_DEPTH</a>;
<a name="l00703"></a>00703 <span class="keywordflow">if</span> (!ustrcmp(s, <span class="stringliteral">"window_x"</span>))
<a name="l00704"></a>00704 opt |= <a class="code" href="group__settings.html#gafea8132efd1fcac7a7f997ef0fe34cfa" title="Requests a placement of the window to a specified pixel location.">AGL_WINDOW_X</a>;
<a name="l00705"></a>00705 <span class="keywordflow">if</span> (!ustrcmp(s, <span class="stringliteral">"window_y"</span>))
<a name="l00706"></a>00706 opt |= <a class="code" href="group__settings.html#ga80b7ef911d06ddee6d94d528cc6d914a" title="Same as AGL_WINDOW_X, but for the y-axis.">AGL_WINDOW_Y</a>;
<a name="l00707"></a>00707 <span class="keywordflow">if</span> (!ustrcmp(s, <span class="stringliteral">"fullscreen"</span>))
<a name="l00708"></a>00708 opt |= <a class="code" href="group__settings.html#ga1baffefcedaffebf7ca47724a0441e60" title="Set if you&#39;d like a full screen mode.">AGL_FULLSCREEN</a>;
<a name="l00709"></a>00709 <span class="keywordflow">if</span> (!ustrcmp(s, <span class="stringliteral">"windowed"</span>))
<a name="l00710"></a>00710 opt |= <a class="code" href="group__settings.html#ga6fcfd5d01183e704595b05fa9812b94f" title="Set if you&#39;d like a windowed mode.">AGL_WINDOWED</a>;
<a name="l00711"></a>00711 <span class="keywordflow">if</span> (!ustrcmp(s, <span class="stringliteral">"video_memory_policy"</span>))
<a name="l00712"></a>00712 opt |= <a class="code" href="group__settings.html#gab78a9c8ca24294b008d706a409c4fa37" title="Define AllegroGL&#39;s policy relative to video memory usage.">AGL_VIDEO_MEMORY_POLICY</a>;
<a name="l00713"></a>00713 <span class="keywordflow">if</span> (!ustrcmp(s, <span class="stringliteral">"sample_buffers"</span>))
<a name="l00714"></a>00714 opt |= <a class="code" href="group__settings.html#gae1836cab58a366c122ace31160fe0e06" title="Define multisample parameters Some OpenGL ICDs expose an extension called GL_ARB_multisample which pr...">AGL_SAMPLE_BUFFERS</a>;
<a name="l00715"></a>00715 <span class="keywordflow">if</span> (!ustrcmp(s, <span class="stringliteral">"samples"</span>))
<a name="l00716"></a>00716 opt |= <a class="code" href="group__settings.html#ga92d9751c38774297013087e89a25749d" title="Define multisample samples Set this value to the number of samples that can be accepted in the multis...">AGL_SAMPLES</a>;
<a name="l00717"></a>00717 <span class="keywordflow">if</span> (!ustrcmp(s, <span class="stringliteral">"float_color"</span>))
<a name="l00718"></a>00718 opt |= <a class="code" href="group__settings.html#gafeffd285319ab06291f90d03ff8b2482" title="Floating-point Color buffer.">AGL_FLOAT_COLOR</a>;
<a name="l00719"></a>00719 <span class="keywordflow">if</span> (!ustrcmp(s, <span class="stringliteral">"float_depth"</span>))
<a name="l00720"></a>00720 opt |= <a class="code" href="group__settings.html#ga468710b6f682956d724f984ab7fa8e02" title="Floating-point Depth buffer.">AGL_FLOAT_Z</a>;
<a name="l00721"></a>00721 }
<a name="l00722"></a>00722
<a name="l00723"></a>00723 free(buf);
<a name="l00724"></a>00724
<a name="l00725"></a>00725 <a class="code" href="group__settings.html#ga025e79a4394803a0e15aaf07b1a8a656" title="Sets a configuration option.">allegro_gl_set</a>(sec, opt);
<a name="l00726"></a>00726 }
<a name="l00727"></a>00727
<a name="l00728"></a>00728
<a name="l00729"></a>00729
<a name="l00730"></a>00730 <span class="comment">/* void allegro_gl_load_settings() */</span>
<a name="l00741"></a><a class="code" href="group__settings.html#ga60a577d2fed019cdae83c648f1ff74ec">00741</a> <span class="keywordtype">void</span> <a class="code" href="group__settings.html#ga60a577d2fed019cdae83c648f1ff74ec" title="Loads the settings from the current config file, in the section [OpenGL].">allegro_gl_load_settings</a>() {
<a name="l00742"></a>00742
<a name="l00743"></a>00743 <span class="keywordtype">int</span> <span class="keyword">set</span>;
<a name="l00744"></a>00744 <span class="keywordtype">char</span> *section = <span class="stringliteral">"OpenGL"</span>;
<a name="l00745"></a>00745
<a name="l00746"></a>00746 <span class="keyword">set</span> = get_config_int(section, <span class="stringliteral">"allegro_format"</span>, -1);
<a name="l00747"></a>00747 <span class="keywordflow">if</span> (<span class="keyword">set</span> != -1)
<a name="l00748"></a>00748 <a class="code" href="group__settings.html#ga025e79a4394803a0e15aaf07b1a8a656" title="Sets a configuration option.">allegro_gl_set</a>(AGL_ALLEGRO_FORMAT, <span class="keyword">set</span>);
<a name="l00749"></a>00749 <span class="keyword">set</span> = get_config_int(section, <span class="stringliteral">"red_depth"</span>, -1);
<a name="l00750"></a>00750 <span class="keywordflow">if</span> (<span class="keyword">set</span> != -1)
<a name="l00751"></a>00751 <a class="code" href="group__settings.html#ga025e79a4394803a0e15aaf07b1a8a656" title="Sets a configuration option.">allegro_gl_set</a>(AGL_RED_DEPTH, <span class="keyword">set</span>);
<a name="l00752"></a>00752 <span class="keyword">set</span> = get_config_int(section, <span class="stringliteral">"green_depth"</span>, -1);
<a name="l00753"></a>00753 <span class="keywordflow">if</span> (<span class="keyword">set</span> != -1)
<a name="l00754"></a>00754 <a class="code" href="group__settings.html#ga025e79a4394803a0e15aaf07b1a8a656" title="Sets a configuration option.">allegro_gl_set</a>(AGL_GREEN_DEPTH, <span class="keyword">set</span>);
<a name="l00755"></a>00755 <span class="keyword">set</span> = get_config_int(section, <span class="stringliteral">"blue_depth"</span>, -1);
<a name="l00756"></a>00756 <span class="keywordflow">if</span> (<span class="keyword">set</span> != -1)
<a name="l00757"></a>00757 <a class="code" href="group__settings.html#ga025e79a4394803a0e15aaf07b1a8a656" title="Sets a configuration option.">allegro_gl_set</a>(AGL_BLUE_DEPTH, <span class="keyword">set</span>);
<a name="l00758"></a>00758 <span class="keyword">set</span> = get_config_int(section, <span class="stringliteral">"alpha_depth"</span>, -1);
<a name="l00759"></a>00759 <span class="keywordflow">if</span> (<span class="keyword">set</span> != -1)
<a name="l00760"></a>00760 <a class="code" href="group__settings.html#ga025e79a4394803a0e15aaf07b1a8a656" title="Sets a configuration option.">allegro_gl_set</a>(AGL_ALPHA_DEPTH, <span class="keyword">set</span>);
<a name="l00761"></a>00761 <span class="keyword">set</span> = get_config_int(section, <span class="stringliteral">"color_depth"</span>, -1);
<a name="l00762"></a>00762 <span class="keywordflow">if</span> (<span class="keyword">set</span> != -1)
<a name="l00763"></a>00763 <a class="code" href="group__settings.html#ga025e79a4394803a0e15aaf07b1a8a656" title="Sets a configuration option.">allegro_gl_set</a>(AGL_COLOR_DEPTH, <span class="keyword">set</span>);
<a name="l00764"></a>00764 <span class="keyword">set</span> = get_config_int(section, <span class="stringliteral">"accum_red_depth"</span>, -1);
<a name="l00765"></a>00765 <span class="keywordflow">if</span> (<span class="keyword">set</span> != -1)
<a name="l00766"></a>00766 <a class="code" href="group__settings.html#ga025e79a4394803a0e15aaf07b1a8a656" title="Sets a configuration option.">allegro_gl_set</a>(AGL_ACC_RED_DEPTH, <span class="keyword">set</span>);
<a name="l00767"></a>00767 <span class="keyword">set</span> = get_config_int(section, <span class="stringliteral">"accum_green_depth"</span>, -1);
<a name="l00768"></a>00768 <span class="keywordflow">if</span> (<span class="keyword">set</span> != -1)
<a name="l00769"></a>00769 <a class="code" href="group__settings.html#ga025e79a4394803a0e15aaf07b1a8a656" title="Sets a configuration option.">allegro_gl_set</a>(AGL_ACC_GREEN_DEPTH, <span class="keyword">set</span>);
<a name="l00770"></a>00770 <span class="keyword">set</span> = get_config_int(section, <span class="stringliteral">"accum_blue_depth"</span>, -1);
<a name="l00771"></a>00771 <span class="keywordflow">if</span> (<span class="keyword">set</span> != -1)
<a name="l00772"></a>00772 <a class="code" href="group__settings.html#ga025e79a4394803a0e15aaf07b1a8a656" title="Sets a configuration option.">allegro_gl_set</a>(AGL_ACC_BLUE_DEPTH, <span class="keyword">set</span>);
<a name="l00773"></a>00773 <span class="keyword">set</span> = get_config_int(section, <span class="stringliteral">"accum_alpha_depth"</span>, -1);
<a name="l00774"></a>00774 <span class="keywordflow">if</span> (<span class="keyword">set</span> != -1)
<a name="l00775"></a>00775 <a class="code" href="group__settings.html#ga025e79a4394803a0e15aaf07b1a8a656" title="Sets a configuration option.">allegro_gl_set</a>(AGL_ACC_ALPHA_DEPTH, <span class="keyword">set</span>);
<a name="l00776"></a>00776 <span class="keyword">set</span> = get_config_int(section, <span class="stringliteral">"double_buffer"</span>, -1);
<a name="l00777"></a>00777 <span class="keywordflow">if</span> (<span class="keyword">set</span> != -1)
<a name="l00778"></a>00778 <a class="code" href="group__settings.html#ga025e79a4394803a0e15aaf07b1a8a656" title="Sets a configuration option.">allegro_gl_set</a>(AGL_DOUBLEBUFFER, <span class="keyword">set</span>);
<a name="l00779"></a>00779 <span class="keyword">set</span> = get_config_int(section, <span class="stringliteral">"stereo_display"</span>, -1);
<a name="l00780"></a>00780 <span class="keywordflow">if</span> (<span class="keyword">set</span> != -1)
<a name="l00781"></a>00781 <a class="code" href="group__settings.html#ga025e79a4394803a0e15aaf07b1a8a656" title="Sets a configuration option.">allegro_gl_set</a>(AGL_STEREO, <span class="keyword">set</span>);
<a name="l00782"></a>00782 <span class="keyword">set</span> = get_config_int(section, <span class="stringliteral">"aux_buffers"</span>, -1);
<a name="l00783"></a>00783 <span class="keywordflow">if</span> (<span class="keyword">set</span> != -1)
<a name="l00784"></a>00784 <a class="code" href="group__settings.html#ga025e79a4394803a0e15aaf07b1a8a656" title="Sets a configuration option.">allegro_gl_set</a>(AGL_AUX_BUFFERS, <span class="keyword">set</span>);
<a name="l00785"></a>00785 <span class="keyword">set</span> = get_config_int(section, <span class="stringliteral">"z_depth"</span>, -1);
<a name="l00786"></a>00786 <span class="keywordflow">if</span> (<span class="keyword">set</span> != -1)
<a name="l00787"></a>00787 <a class="code" href="group__settings.html#ga025e79a4394803a0e15aaf07b1a8a656" title="Sets a configuration option.">allegro_gl_set</a>(AGL_Z_DEPTH, <span class="keyword">set</span>);
<a name="l00788"></a>00788 <span class="keyword">set</span> = get_config_int(section, <span class="stringliteral">"stencil_depth"</span>, -1);
<a name="l00789"></a>00789 <span class="keywordflow">if</span> (<span class="keyword">set</span> != -1)
<a name="l00790"></a>00790 <a class="code" href="group__settings.html#ga025e79a4394803a0e15aaf07b1a8a656" title="Sets a configuration option.">allegro_gl_set</a>(AGL_STENCIL_DEPTH, <span class="keyword">set</span>);
<a name="l00791"></a>00791 <span class="keyword">set</span> = get_config_int(section, <span class="stringliteral">"window_x"</span>, -1);
<a name="l00792"></a>00792 <span class="keywordflow">if</span> (<span class="keyword">set</span> != -1)
<a name="l00793"></a>00793 <a class="code" href="group__settings.html#ga025e79a4394803a0e15aaf07b1a8a656" title="Sets a configuration option.">allegro_gl_set</a>(AGL_WINDOW_X, <span class="keyword">set</span>);
<a name="l00794"></a>00794 <span class="keyword">set</span> = get_config_int(section, <span class="stringliteral">"window_y"</span>, -1);
<a name="l00795"></a>00795 <span class="keywordflow">if</span> (<span class="keyword">set</span> != -1)
<a name="l00796"></a>00796 <a class="code" href="group__settings.html#ga025e79a4394803a0e15aaf07b1a8a656" title="Sets a configuration option.">allegro_gl_set</a>(AGL_WINDOW_Y, <span class="keyword">set</span>);
<a name="l00797"></a>00797 <span class="keyword">set</span> = get_config_int(section, <span class="stringliteral">"fullscreen"</span>, -1);
<a name="l00798"></a>00798 <span class="keywordflow">if</span> (<span class="keyword">set</span> != -1)
<a name="l00799"></a>00799 <a class="code" href="group__settings.html#ga025e79a4394803a0e15aaf07b1a8a656" title="Sets a configuration option.">allegro_gl_set</a>(AGL_FULLSCREEN, <span class="keyword">set</span>);
<a name="l00800"></a>00800 <span class="keyword">set</span> = get_config_int(section, <span class="stringliteral">"windowed"</span>, -1);
<a name="l00801"></a>00801 <span class="keywordflow">if</span> (<span class="keyword">set</span> != -1)
<a name="l00802"></a>00802 <a class="code" href="group__settings.html#ga025e79a4394803a0e15aaf07b1a8a656" title="Sets a configuration option.">allegro_gl_set</a>(AGL_WINDOWED, <span class="keyword">set</span>);
<a name="l00803"></a>00803 <span class="keyword">set</span> = get_config_int(section, <span class="stringliteral">"video_memory_policy"</span>, -1);
<a name="l00804"></a>00804 <span class="keywordflow">if</span> (<span class="keyword">set</span> != -1)
<a name="l00805"></a>00805 <a class="code" href="group__settings.html#ga025e79a4394803a0e15aaf07b1a8a656" title="Sets a configuration option.">allegro_gl_set</a>(AGL_VIDEO_MEMORY_POLICY, <span class="keyword">set</span>);
<a name="l00806"></a>00806 <span class="keyword">set</span> = get_config_int(section, <span class="stringliteral">"sample_buffers"</span>, -1);
<a name="l00807"></a>00807 <span class="keywordflow">if</span> (<span class="keyword">set</span> != -1)
<a name="l00808"></a>00808 <a class="code" href="group__settings.html#ga025e79a4394803a0e15aaf07b1a8a656" title="Sets a configuration option.">allegro_gl_set</a>(AGL_SAMPLE_BUFFERS, <span class="keyword">set</span>);
<a name="l00809"></a>00809 <span class="keyword">set</span> = get_config_int(section, <span class="stringliteral">"samples"</span>, -1);
<a name="l00810"></a>00810 <span class="keywordflow">if</span> (<span class="keyword">set</span> != -1)
<a name="l00811"></a>00811 <a class="code" href="group__settings.html#ga025e79a4394803a0e15aaf07b1a8a656" title="Sets a configuration option.">allegro_gl_set</a>(AGL_SAMPLES, <span class="keyword">set</span>);
<a name="l00812"></a>00812 <span class="keyword">set</span> = get_config_int(section, <span class="stringliteral">"float_color"</span>, -1);
<a name="l00813"></a>00813 <span class="keywordflow">if</span> (<span class="keyword">set</span> != -1)
<a name="l00814"></a>00814 <a class="code" href="group__settings.html#ga025e79a4394803a0e15aaf07b1a8a656" title="Sets a configuration option.">allegro_gl_set</a>(AGL_FLOAT_COLOR, <span class="keyword">set</span>);
<a name="l00815"></a>00815 <span class="keyword">set</span> = get_config_int(section, <span class="stringliteral">"float_depth"</span>, -1);
<a name="l00816"></a>00816 <span class="keywordflow">if</span> (<span class="keyword">set</span> != -1)
<a name="l00817"></a>00817 <a class="code" href="group__settings.html#ga025e79a4394803a0e15aaf07b1a8a656" title="Sets a configuration option.">allegro_gl_set</a>(<a class="code" href="group__settings.html#ga468710b6f682956d724f984ab7fa8e02" title="Floating-point Depth buffer.">AGL_FLOAT_Z</a>, <span class="keyword">set</span>);
<a name="l00818"></a>00818
<a name="l00819"></a>00819 agl_parse_section(<a class="code" href="group__settings.html#ga839ae567340a64a97480e6abf1743b5f" title="Reject other values for these settings.">AGL_REQUIRE</a>, section, <span class="stringliteral">"require"</span>);
<a name="l00820"></a>00820 agl_parse_section(<a class="code" href="group__settings.html#ga5a1518fe9c1b44beb7f5bdcc42b6b8f1" title="Prefer the assigned values for these settings.">AGL_SUGGEST</a>, section, <span class="stringliteral">"suggest"</span>);
<a name="l00821"></a>00821 }
<a name="l00822"></a>00822
<a name="l00823"></a>00823
<a name="l00824"></a>00824
<a name="l00825"></a>00825 <span class="comment">/* int install_allegro_gl(void) */</span>
<a name="l00836"></a><a class="code" href="group__core.html#gaa0cbb82fa1e2bae6788eb7bd06673bd3">00836</a> <span class="keywordtype">int</span> <a class="code" href="group__core.html#gaa0cbb82fa1e2bae6788eb7bd06673bd3" title="Installs the AllegroGL addon to Allegro.">install_allegro_gl</a>(<span class="keywordtype">void</span>)
<a name="l00837"></a>00837 {
<a name="l00838"></a>00838 <span class="keywordflow">if</span> (!system_driver)
<a name="l00839"></a>00839 <span class="keywordflow">return</span> -1;
<a name="l00840"></a>00840
<a name="l00841"></a>00841 <span class="keywordflow">if</span> (atexit(<a class="code" href="group__core.html#gaeff6abbb1d1071a01f4cd694ef504298" title="Removes the AllegroGL addon.">remove_allegro_gl</a>))
<a name="l00842"></a>00842 <span class="keywordflow">return</span> -1;
<a name="l00843"></a>00843
<a name="l00844"></a>00844 <span class="keywordflow">if</span> (system_driver->gfx_drivers)
<a name="l00845"></a>00845 saved_gfx_drivers = system_driver->gfx_drivers;
<a name="l00846"></a>00846 <span class="keywordflow">else</span>
<a name="l00847"></a>00847 saved_gfx_drivers = list_saved_gfx_drivers;
<a name="l00848"></a>00848
<a name="l00849"></a>00849 system_driver->gfx_drivers = our_gfx_drivers;
<a name="l00850"></a>00850
<a name="l00851"></a>00851 <a class="code" href="group__settings.html#gadd1249980001c22cb3eba880561a7e19" title="Clear the option settings All settings are set to their default values, and marked as neither suggest...">allegro_gl_clear_settings</a>();
<a name="l00852"></a>00852
<a name="l00853"></a>00853 <span class="comment">/* Save and replace old blit_between_formats methods */</span>
<a name="l00854"></a>00854 <span class="preprocessor">#ifdef ALLEGRO_COLOR8</span>
<a name="l00855"></a>00855 <span class="preprocessor"></span> __blit_between_formats8 = __linear_vtable8.blit_between_formats;
<a name="l00856"></a>00856 __linear_vtable8.blit_between_formats =
<a name="l00857"></a>00857 allegro_gl_memory_blit_between_formats;
<a name="l00858"></a>00858 <span class="preprocessor">#endif</span>
<a name="l00859"></a>00859 <span class="preprocessor"></span><span class="preprocessor">#ifdef ALLEGRO_COLOR16</span>
<a name="l00860"></a>00860 <span class="preprocessor"></span> __blit_between_formats15 = __linear_vtable15.blit_between_formats;
<a name="l00861"></a>00861 __linear_vtable15.blit_between_formats =
<a name="l00862"></a>00862 allegro_gl_memory_blit_between_formats;
<a name="l00863"></a>00863 __blit_between_formats16 = __linear_vtable16.blit_between_formats;
<a name="l00864"></a>00864 __linear_vtable16.blit_between_formats
<a name="l00865"></a>00865 = allegro_gl_memory_blit_between_formats;
<a name="l00866"></a>00866 <span class="preprocessor">#endif</span>
<a name="l00867"></a>00867 <span class="preprocessor"></span><span class="preprocessor">#ifdef ALLEGRO_COLOR24</span>
<a name="l00868"></a>00868 <span class="preprocessor"></span> __blit_between_formats24 = __linear_vtable24.blit_between_formats;
<a name="l00869"></a>00869 __linear_vtable24.blit_between_formats
<a name="l00870"></a>00870 = allegro_gl_memory_blit_between_formats;
<a name="l00871"></a>00871 <span class="preprocessor">#endif</span>
<a name="l00872"></a>00872 <span class="preprocessor"></span><span class="preprocessor">#ifdef ALLEGRO_COLOR32</span>
<a name="l00873"></a>00873 <span class="preprocessor"></span> __blit_between_formats32 = __linear_vtable32.blit_between_formats;
<a name="l00874"></a>00874 __linear_vtable32.blit_between_formats
<a name="l00875"></a>00875 = allegro_gl_memory_blit_between_formats;
<a name="l00876"></a>00876 <span class="preprocessor">#endif</span>
<a name="l00877"></a>00877 <span class="preprocessor"></span>
<a name="l00878"></a>00878 usetc(allegro_gl_error, 0);
<a name="l00879"></a>00879
<a name="l00880"></a>00880 <span class="keywordflow">return</span> 0;
<a name="l00881"></a>00881 }
<a name="l00882"></a>00882
<a name="l00883"></a>00883
<a name="l00884"></a>00884
<a name="l00885"></a>00885 <span class="comment">/* void remove_allegro_gl(void) */</span>
<a name="l00894"></a><a class="code" href="group__core.html#gaeff6abbb1d1071a01f4cd694ef504298">00894</a> <span class="keywordtype">void</span> <a class="code" href="group__core.html#gaeff6abbb1d1071a01f4cd694ef504298" title="Removes the AllegroGL addon.">remove_allegro_gl</a>(<span class="keywordtype">void</span>)
<a name="l00895"></a>00895 {
<a name="l00896"></a>00896 <span class="keywordflow">if</span> ((!system_driver) || (!saved_gfx_drivers))
<a name="l00897"></a>00897 <span class="keywordflow">return</span>;
<a name="l00898"></a>00898
<a name="l00899"></a>00899 <span class="keywordflow">if</span> (saved_gfx_drivers == &list_saved_gfx_drivers)
<a name="l00900"></a>00900 system_driver->gfx_drivers = NULL;
<a name="l00901"></a>00901 <span class="keywordflow">else</span>
<a name="l00902"></a>00902 system_driver->gfx_drivers = saved_gfx_drivers;
<a name="l00903"></a>00903
<a name="l00904"></a>00904 <span class="comment">/* This function may be called twice (once by a user explicit call</span>
<a name="l00905"></a>00905 <span class="comment"> * and once again at exit since the function is registered with at_exit)</span>
<a name="l00906"></a>00906 <span class="comment"> * In order to prevent crashes, 'saved_gfx_drivers' is set to NULL</span>
<a name="l00907"></a>00907 <span class="comment"> */</span>
<a name="l00908"></a>00908 saved_gfx_drivers = NULL;
<a name="l00909"></a>00909
<a name="l00910"></a>00910 <span class="comment">/* Restore the blit_between_formats methods */</span>
<a name="l00911"></a>00911 <span class="preprocessor"> #ifdef ALLEGRO_COLOR8</span>
<a name="l00912"></a>00912 <span class="preprocessor"></span> __linear_vtable8.blit_between_formats = __blit_between_formats8;
<a name="l00913"></a>00913 <span class="preprocessor"> #endif</span>
<a name="l00914"></a>00914 <span class="preprocessor"></span><span class="preprocessor"> #ifdef ALLEGRO_COLOR16</span>
<a name="l00915"></a>00915 <span class="preprocessor"></span> __linear_vtable15.blit_between_formats = __blit_between_formats15;
<a name="l00916"></a>00916 __linear_vtable16.blit_between_formats = __blit_between_formats16;
<a name="l00917"></a>00917 <span class="preprocessor"> #endif</span>
<a name="l00918"></a>00918 <span class="preprocessor"></span><span class="preprocessor"> #ifdef ALLEGRO_COLOR24</span>
<a name="l00919"></a>00919 <span class="preprocessor"></span> __linear_vtable24.blit_between_formats = __blit_between_formats24;
<a name="l00920"></a>00920 <span class="preprocessor"> #endif</span>
<a name="l00921"></a>00921 <span class="preprocessor"></span><span class="preprocessor"> #ifdef ALLEGRO_COLOR32</span>
<a name="l00922"></a>00922 <span class="preprocessor"></span> __linear_vtable32.blit_between_formats = __blit_between_formats32;
<a name="l00923"></a>00923 <span class="preprocessor"> #endif</span>
<a name="l00924"></a>00924 <span class="preprocessor"></span>}
<a name="l00925"></a>00925
<a name="l00926"></a>00926
<a name="l00927"></a>00927
<a name="l00928"></a>00928 <span class="comment">/* void allegro_gl_flip(void) */</span>
<a name="l00951"></a><a class="code" href="group__core.html#gaf5aad043e99b766393fa4a7ec034a0f1">00951</a> <span class="keywordtype">void</span> <a class="code" href="group__core.html#gaf5aad043e99b766393fa4a7ec034a0f1" title="Flips the front and back framebuffers.">allegro_gl_flip</a>(<span class="keywordtype">void</span>)
<a name="l00952"></a>00952 {
<a name="l00953"></a>00953 __allegro_gl_driver->flip();
<a name="l00954"></a>00954 }
<a name="l00955"></a>00955
<a name="l00956"></a>00956
<a name="l00957"></a>00957
<a name="l00958"></a>00958 <span class="comment">/* float allegro_gl_opengl_version() */</span>
<a name="l00971"></a><a class="code" href="group__core.html#ga444d507eaeb5ba800787f6a81827615d">00971</a> <span class="keywordtype">float</span> <a class="code" href="group__core.html#ga444d507eaeb5ba800787f6a81827615d" title="Returns the OpenGL version number of the client (the computer the program is running on)...">allegro_gl_opengl_version</a>() {
<a name="l00972"></a>00972
<a name="l00973"></a>00973 <span class="keyword">const</span> <span class="keywordtype">char</span> *str;
<a name="l00974"></a>00974
<a name="l00975"></a>00975 <span class="keywordflow">if</span> (!__allegro_gl_valid_context)
<a name="l00976"></a>00976 <span class="keywordflow">return</span> 0.0f;
<a name="l00977"></a>00977
<a name="l00978"></a>00978 str = (<span class="keyword">const</span> <span class="keywordtype">char</span>*)glGetString(GL_VERSION);
<a name="l00979"></a>00979
<a name="l00980"></a>00980 <span class="keywordflow">if</span> ((strncmp(str, <span class="stringliteral">"1.0 "</span>, 4) == 0) || (strncmp(str, <span class="stringliteral">"1.0.0 "</span>, 6) == 0))
<a name="l00981"></a>00981 <span class="keywordflow">return</span> 1.0;
<a name="l00982"></a>00982 <span class="keywordflow">if</span> ((strncmp(str, <span class="stringliteral">"1.1 "</span>, 4) == 0) || (strncmp(str, <span class="stringliteral">"1.1.0 "</span>, 6) == 0))
<a name="l00983"></a>00983 <span class="keywordflow">return</span> 1.1;
<a name="l00984"></a>00984 <span class="keywordflow">if</span> ((strncmp(str, <span class="stringliteral">"1.2 "</span>, 4) == 0) || (strncmp(str, <span class="stringliteral">"1.2.0 "</span>, 6) == 0))
<a name="l00985"></a>00985 <span class="keywordflow">return</span> 1.2;
<a name="l00986"></a>00986 <span class="keywordflow">if</span> ((strncmp(str, <span class="stringliteral">"1.2.1 "</span>, 6) == 0))
<a name="l00987"></a>00987 <span class="keywordflow">return</span> 1.21;
<a name="l00988"></a>00988 <span class="keywordflow">if</span> ((strncmp(str, <span class="stringliteral">"1.2.2 "</span>, 6) == 0))
<a name="l00989"></a>00989 <span class="keywordflow">return</span> 1.22;
<a name="l00990"></a>00990 <span class="keywordflow">if</span> ((strncmp(str, <span class="stringliteral">"1.3 "</span>, 4) == 0) || (strncmp(str, <span class="stringliteral">"1.3.0 "</span>, 6) == 0))
<a name="l00991"></a>00991 <span class="keywordflow">return</span> 1.3;
<a name="l00992"></a>00992 <span class="keywordflow">if</span> ((strncmp(str, <span class="stringliteral">"1.4 "</span>, 4) == 0) || (strncmp(str, <span class="stringliteral">"1.4.0 "</span>, 6) == 0))
<a name="l00993"></a>00993 <span class="keywordflow">return</span> 1.4;
<a name="l00994"></a>00994 <span class="keywordflow">if</span> ((strncmp(str, <span class="stringliteral">"1.5 "</span>, 4) == 0) || (strncmp(str, <span class="stringliteral">"1.5.0 "</span>, 6) == 0))
<a name="l00995"></a>00995 <span class="keywordflow">return</span> 1.5;
<a name="l00996"></a>00996 <span class="keywordflow">if</span> ((strncmp(str, <span class="stringliteral">"2.0 "</span>, 4) == 0) || (strncmp(str, <span class="stringliteral">"2.0.0 "</span>, 6) == 0))
<a name="l00997"></a>00997 <span class="keywordflow">return</span> 2.0;
<a name="l00998"></a>00998 <span class="keywordflow">if</span> ((strncmp(str, <span class="stringliteral">"2.1 "</span>, 4) == 0) || (strncmp(str, <span class="stringliteral">"2.1.0 "</span>, 6) == 0))
<a name="l00999"></a>00999 <span class="keywordflow">return</span> 2.1;
<a name="l01000"></a>01000 <span class="keywordflow">if</span> ((strncmp(str, <span class="stringliteral">"3.0 "</span>, 4) == 0) || (strncmp(str, <span class="stringliteral">"3.0.0 "</span>, 6) == 0))
<a name="l01001"></a>01001 <span class="keywordflow">return</span> 3.0;
<a name="l01002"></a>01002
<a name="l01003"></a>01003 <span class="comment">/* The OpenGL driver does not return a version</span>
<a name="l01004"></a>01004 <span class="comment"> * number. However it probably supports at least OpenGL 1.0</span>
<a name="l01005"></a>01005 <span class="comment"> */</span>
<a name="l01006"></a>01006 <span class="keywordflow">if</span> (!str) {
<a name="l01007"></a>01007 <span class="keywordflow">return</span> 1.0;
<a name="l01008"></a>01008 }
<a name="l01009"></a>01009
<a name="l01010"></a>01010 <span class="keywordflow">return</span> atof(str);
<a name="l01011"></a>01011 }
<a name="l01012"></a>01012
<a name="l01013"></a>01013
<a name="l01014"></a>01014
<a name="l01015"></a>01015 <span class="keywordtype">void</span> __allegro_gl_set_allegro_image_format(<span class="keywordtype">int</span> big_endian)
<a name="l01016"></a>01016 {
<a name="l01017"></a>01017 <span class="comment">/* Sets up Allegro to use OpenGL formats */</span>
<a name="l01018"></a>01018 _rgb_r_shift_15 = 11;
<a name="l01019"></a>01019 _rgb_g_shift_15 = 6;
<a name="l01020"></a>01020 _rgb_b_shift_15 = 1;
<a name="l01021"></a>01021
<a name="l01022"></a>01022 _rgb_r_shift_16 = 11;
<a name="l01023"></a>01023 _rgb_g_shift_16 = 5;
<a name="l01024"></a>01024 _rgb_b_shift_16 = 0;
<a name="l01025"></a>01025
<a name="l01026"></a>01026 <span class="keywordflow">if</span> (big_endian) {
<a name="l01027"></a>01027 _rgb_r_shift_24 = 16;
<a name="l01028"></a>01028 _rgb_g_shift_24 = 8;
<a name="l01029"></a>01029 _rgb_b_shift_24 = 0;
<a name="l01030"></a>01030
<a name="l01031"></a>01031 _rgb_a_shift_32 = 0;
<a name="l01032"></a>01032 _rgb_r_shift_32 = 24;
<a name="l01033"></a>01033 _rgb_g_shift_32 = 16;
<a name="l01034"></a>01034 _rgb_b_shift_32 = 8;
<a name="l01035"></a>01035 }
<a name="l01036"></a>01036 <span class="keywordflow">else</span> {
<a name="l01037"></a>01037 _rgb_r_shift_24 = 0;
<a name="l01038"></a>01038 _rgb_g_shift_24 = 8;
<a name="l01039"></a>01039 _rgb_b_shift_24 = 16;
<a name="l01040"></a>01040
<a name="l01041"></a>01041 _rgb_r_shift_32 = 0;
<a name="l01042"></a>01042 _rgb_g_shift_32 = 8;
<a name="l01043"></a>01043 _rgb_b_shift_32 = 16;
<a name="l01044"></a>01044 _rgb_a_shift_32 = 24;
<a name="l01045"></a>01045 }
<a name="l01046"></a>01046
<a name="l01047"></a>01047 <span class="keywordflow">return</span>;
<a name="l01048"></a>01048 }
<a name="l01049"></a>01049
<a name="l01050"></a>01050
<a name="l01051"></a>01051
<a name="l01052"></a>01052 <span class="comment">/* allegro_gl_default_init:</span>
<a name="l01053"></a>01053 <span class="comment"> * Sets a graphics mode according to the mode (fullscreen or windowed)</span>
<a name="l01054"></a>01054 <span class="comment"> * requested by the user. If it fails to set up the mode then it tries</span>
<a name="l01055"></a>01055 <span class="comment"> * (if available) the other one unless the user has "AGL_REQUIRED" the mode.</span>
<a name="l01056"></a>01056 <span class="comment"> */</span>
<a name="l01057"></a>01057 <span class="keyword">static</span> BITMAP *allegro_gl_default_gfx_init(<span class="keywordtype">int</span> w, <span class="keywordtype">int</span> h, <span class="keywordtype">int</span> vw, <span class="keywordtype">int</span> vh,
<a name="l01058"></a>01058 <span class="keywordtype">int</span> depth)
<a name="l01059"></a>01059 {
<a name="l01060"></a>01060 BITMAP* bmp = NULL;
<a name="l01061"></a>01061
<a name="l01062"></a>01062 <span class="keywordflow">if</span> (allegro_gl_display_info.fullscreen) {
<a name="l01063"></a>01063 TRACE(PREFIX_I <span class="stringliteral">"default_gfx_init: Trying to set up fullscreen mode.\n"</span>);
<a name="l01064"></a>01064
<a name="l01065"></a>01065 <span class="preprocessor">#ifdef GFX_OPENGL_FULLSCREEN</span>
<a name="l01066"></a>01066 <span class="preprocessor"></span> <span class="comment">/* Looks for fullscreen mode in our_driver_list */</span>
<a name="l01067"></a>01067 gfx_driver = &gfx_allegro_gl_fullscreen;
<a name="l01068"></a>01068
<a name="l01069"></a>01069 <span class="keywordflow">if</span> (__allegro_gl_required_settings & AGL_FULLSCREEN)
<a name="l01070"></a>01070 <span class="comment">/* Fullscreen mode required and found */</span>
<a name="l01071"></a>01071 <span class="keywordflow">return</span> gfx_allegro_gl_fullscreen.init(w, h, vw, vh, depth);
<a name="l01072"></a>01072 <span class="keywordflow">else</span>
<a name="l01073"></a>01073 bmp = gfx_allegro_gl_fullscreen.init(w, h, vw, vh, depth);
<a name="l01074"></a>01074
<a name="l01075"></a>01075 <span class="keywordflow">if</span> (bmp)
<a name="l01076"></a>01076 <span class="comment">/* Fullscreen mode found but not required (probably suggested) */</span>
<a name="l01077"></a>01077 <span class="keywordflow">return</span> bmp;
<a name="l01078"></a>01078
<a name="l01079"></a>01079 <span class="preprocessor">#endif </span><span class="comment">/*GFX_OPENGL_FULLSCREEN*/</span>
<a name="l01080"></a>01080
<a name="l01081"></a>01081 <span class="comment">/* Fullscreen mode not available but not required :</span>
<a name="l01082"></a>01082 <span class="comment"> * let's try windowed mode :</span>
<a name="l01083"></a>01083 <span class="comment"> */</span>
<a name="l01084"></a>01084 TRACE(PREFIX_I <span class="stringliteral">"default_gfx_init: Failed to set up fullscreen mode!\n"</span>);
<a name="l01085"></a>01085 <span class="preprocessor">#ifdef GFX_OPENGL_WINDOWED</span>
<a name="l01086"></a>01086 <span class="preprocessor"></span> TRACE(PREFIX_I <span class="stringliteral">"default_gfx_init: Trying windowed mode...\n"</span>);
<a name="l01087"></a>01087 allegro_gl_display_info.fullscreen = FALSE;
<a name="l01088"></a>01088 gfx_driver = &gfx_allegro_gl_windowed;
<a name="l01089"></a>01089 <span class="keywordflow">return</span> gfx_allegro_gl_windowed.init(w, h, vw, vh, depth);
<a name="l01090"></a>01090 <span class="preprocessor">#else</span>
<a name="l01091"></a>01091 <span class="preprocessor"></span> <span class="keywordflow">return</span> NULL;
<a name="l01092"></a>01092 <span class="preprocessor">#endif </span><span class="comment">/* GFX_OPENGL_WINDOWED */</span>
<a name="l01093"></a>01093 }
<a name="l01094"></a>01094 <span class="keywordflow">else</span> {
<a name="l01095"></a>01095 TRACE(PREFIX_I <span class="stringliteral">"default_gfx_init: Trying to set up windowed mode...\n"</span>);
<a name="l01096"></a>01096
<a name="l01097"></a>01097 <span class="preprocessor">#ifdef GFX_OPENGL_WINDOWED</span>
<a name="l01098"></a>01098 <span class="preprocessor"></span> <span class="comment">/* Looks for windowed mode in our_driver_list */</span>
<a name="l01099"></a>01099 gfx_driver = &gfx_allegro_gl_windowed;
<a name="l01100"></a>01100
<a name="l01101"></a>01101 <span class="keywordflow">if</span> (__allegro_gl_required_settings & AGL_WINDOWED)
<a name="l01102"></a>01102 <span class="comment">/* Windowed mode required and found */</span>
<a name="l01103"></a>01103 <span class="keywordflow">return</span> gfx_allegro_gl_windowed.init(w, h, vw, vh, depth);
<a name="l01104"></a>01104 <span class="keywordflow">else</span>
<a name="l01105"></a>01105 bmp = gfx_allegro_gl_windowed.init(w, h, vw, vh, depth);
<a name="l01106"></a>01106
<a name="l01107"></a>01107 <span class="keywordflow">if</span> (bmp)
<a name="l01108"></a>01108 <span class="comment">/* Windowed mode found but not required (probably suggested) */</span>
<a name="l01109"></a>01109 <span class="keywordflow">return</span> bmp;
<a name="l01110"></a>01110
<a name="l01111"></a>01111 <span class="preprocessor">#endif </span><span class="comment">/* GFX_OPENGL_WINDOWED */</span>
<a name="l01112"></a>01112
<a name="l01113"></a>01113 <span class="comment">/* Windowed mode not available but not required :</span>
<a name="l01114"></a>01114 <span class="comment"> * let's try fullscreen mode :</span>
<a name="l01115"></a>01115 <span class="comment"> */</span>
<a name="l01116"></a>01116 TRACE(PREFIX_I <span class="stringliteral">"default_gfx_init: Failed to set up windowed mode...\n"</span>);
<a name="l01117"></a>01117 <span class="preprocessor">#ifdef GFX_OPENGL_FULLSCREEN</span>
<a name="l01118"></a>01118 <span class="preprocessor"></span> TRACE(PREFIX_I <span class="stringliteral">"default_gfx_init: Trying fullscreen mode...\n"</span>);
<a name="l01119"></a>01119 allegro_gl_display_info.fullscreen = TRUE;
<a name="l01120"></a>01120 gfx_driver = &gfx_allegro_gl_fullscreen;
<a name="l01121"></a>01121 <span class="keywordflow">return</span> gfx_allegro_gl_fullscreen.init(w, h, vw, vh, depth);
<a name="l01122"></a>01122 <span class="preprocessor">#else</span>
<a name="l01123"></a>01123 <span class="preprocessor"></span> <span class="keywordflow">return</span> NULL;
<a name="l01124"></a>01124 <span class="preprocessor">#endif </span><span class="comment">/*GFX_OPENGL_FULLSCREEN*/</span>
<a name="l01125"></a>01125 }
<a name="l01126"></a>01126 }
<a name="l01127"></a>01127
<a name="l01128"></a>01128
<a name="l01129"></a>01129
<a name="l01130"></a>01130 <span class="comment">/* allegro_gl_set_blender_mode (GFX_DRIVER vtable entry):</span>
<a name="l01131"></a>01131 <span class="comment"> * Sets the blending mode. Same implementation to all GFX vtables.</span>
<a name="l01132"></a>01132 <span class="comment"> */</span>
<a name="l01133"></a>01133 <span class="keywordtype">void</span> allegro_gl_set_blender_mode(<span class="keywordtype">int</span> mode, <span class="keywordtype">int</span> r, <span class="keywordtype">int</span> g, <span class="keywordtype">int</span> b, <span class="keywordtype">int</span> a) {
<a name="l01134"></a>01134 __allegro_gl_blit_operation = AGL_OP_BLEND;
<a name="l01135"></a>01135 <span class="comment">/* These blenders do not need any special extensions. </span>
<a name="l01136"></a>01136 <span class="comment"> * We specify only pixel arithmetic here. Blend equation and blend</span>
<a name="l01137"></a>01137 <span class="comment"> * color (if available) are reset to defualt later.*/</span>
<a name="l01138"></a>01138 <span class="keywordflow">switch</span> (mode) {
<a name="l01139"></a>01139 <span class="keywordflow">case</span> blender_mode_none:
<a name="l01140"></a>01140 glBlendFunc(GL_ONE, GL_ZERO);
<a name="l01141"></a>01141 <span class="keywordflow">break</span>;
<a name="l01142"></a>01142 <span class="keywordflow">case</span> blender_mode_alpha:
<a name="l01143"></a>01143 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
<a name="l01144"></a>01144 <span class="keywordflow">break</span>;
<a name="l01145"></a>01145 <span class="keywordflow">case</span> blender_mode_invert:
<a name="l01146"></a>01146 glLogicOp(GL_COPY_INVERTED);
<a name="l01147"></a>01147 __allegro_gl_blit_operation = AGL_OP_LOGIC_OP;
<a name="l01148"></a>01148 <span class="keywordflow">break</span>;
<a name="l01149"></a>01149 <span class="keywordflow">case</span> blender_mode_multiply:
<a name="l01150"></a>01150 glBlendFunc(GL_DST_COLOR, GL_ZERO);
<a name="l01151"></a>01151 <span class="keywordflow">break</span>;
<a name="l01152"></a>01152 }
<a name="l01153"></a>01153
<a name="l01154"></a>01154 <span class="keywordflow">if</span> (<a class="code" href="group__core.html#ga444d507eaeb5ba800787f6a81827615d" title="Returns the OpenGL version number of the client (the computer the program is running on)...">allegro_gl_opengl_version</a>() >= 1.4 ||
<a name="l01155"></a>01155 (<a class="code" href="group__core.html#ga444d507eaeb5ba800787f6a81827615d" title="Returns the OpenGL version number of the client (the computer the program is running on)...">allegro_gl_opengl_version</a>() >= 1.2 &&
<a name="l01156"></a>01156 <a class="code" href="group__extensions.html#ga7351f56ea1c4f4665193fc3bf547ff0a" title="This function is an helper to determine whether an OpenGL extension is available or not...">allegro_gl_is_extension_supported</a>(<span class="stringliteral">"GL_ARB_imaging"</span>))) {
<a name="l01157"></a>01157 <span class="comment">/* We're running a recent version of OpenGL and everything needed is here. */</span>
<a name="l01158"></a>01158
<a name="l01159"></a>01159 glBlendColor(r / 255.f, g / 255.f, b / 255.f, a / 255.f);
<a name="l01160"></a>01160
<a name="l01161"></a>01161 <span class="keywordflow">switch</span> (mode) {
<a name="l01162"></a>01162 <span class="keywordflow">case</span> blender_mode_none:
<a name="l01163"></a>01163 glBlendEquation(GL_FUNC_ADD);
<a name="l01164"></a>01164 <span class="keywordflow">break</span>;
<a name="l01165"></a>01165 <span class="keywordflow">case</span> blender_mode_alpha:
<a name="l01166"></a>01166 glBlendEquation(GL_FUNC_ADD);
<a name="l01167"></a>01167 <span class="keywordflow">break</span>;
<a name="l01168"></a>01168 <span class="keywordflow">case</span> blender_mode_trans:
<a name="l01169"></a>01169 glBlendEquation(GL_FUNC_ADD);
<a name="l01170"></a>01170 glBlendFunc(GL_CONSTANT_ALPHA, GL_ONE_MINUS_CONSTANT_ALPHA);
<a name="l01171"></a>01171 <span class="keywordflow">break</span>;
<a name="l01172"></a>01172 <span class="keywordflow">case</span> blender_mode_add:
<a name="l01173"></a>01173 glBlendEquation(GL_FUNC_ADD);
<a name="l01174"></a>01174 glBlendFunc(GL_CONSTANT_ALPHA, GL_ONE);
<a name="l01175"></a>01175 <span class="keywordflow">break</span>;
<a name="l01176"></a>01176 <span class="keywordflow">case</span> blender_mode_burn:
<a name="l01177"></a>01177 glBlendEquation(GL_FUNC_SUBTRACT);
<a name="l01178"></a>01178 glBlendFunc(GL_ONE, GL_CONSTANT_ALPHA);
<a name="l01179"></a>01179 <span class="keywordflow">break</span>;
<a name="l01180"></a>01180 <span class="keywordflow">case</span> blender_mode_dodge:
<a name="l01181"></a>01181 glBlendEquation(GL_FUNC_ADD);
<a name="l01182"></a>01182 glBlendFunc(GL_ONE, GL_CONSTANT_ALPHA);
<a name="l01183"></a>01183 <span class="keywordflow">break</span>;
<a name="l01184"></a>01184 <span class="keywordflow">case</span> blender_mode_multiply:
<a name="l01185"></a>01185 glBlendEquation(GL_FUNC_ADD);
<a name="l01186"></a>01186 <span class="keywordflow">break</span>;
<a name="l01187"></a>01187 }
<a name="l01188"></a>01188
<a name="l01189"></a>01189 <span class="keywordflow">return</span>;
<a name="l01190"></a>01190 }
<a name="l01191"></a>01191
<a name="l01192"></a>01192 <span class="comment">/* Check for presence of glBlendColor() and special parameters to</span>
<a name="l01193"></a>01193 <span class="comment"> * glBlendFunc(). */</span>
<a name="l01194"></a>01194 <span class="keywordflow">if</span> (<a class="code" href="group__extensions.html#ga7351f56ea1c4f4665193fc3bf547ff0a" title="This function is an helper to determine whether an OpenGL extension is available or not...">allegro_gl_is_extension_supported</a>(<span class="stringliteral">"GL_EXT_blend_color"</span>)) {
<a name="l01195"></a>01195 glBlendColorEXT(r / 255.f, g / 255.f, b / 255.f, a / 255.f);
<a name="l01196"></a>01196
<a name="l01197"></a>01197 <span class="keywordflow">switch</span> (mode) {
<a name="l01198"></a>01198 <span class="keywordflow">case</span> blender_mode_trans:
<a name="l01199"></a>01199 glBlendFunc(GL_CONSTANT_ALPHA_EXT, GL_ONE_MINUS_CONSTANT_ALPHA_EXT);
<a name="l01200"></a>01200 <span class="keywordflow">break</span>;
<a name="l01201"></a>01201 <span class="keywordflow">case</span> blender_mode_add:
<a name="l01202"></a>01202 glBlendFunc(GL_CONSTANT_ALPHA_EXT, GL_ONE);
<a name="l01203"></a>01203 <span class="keywordflow">break</span>;
<a name="l01204"></a>01204 <span class="keywordflow">case</span> blender_mode_burn:
<a name="l01205"></a>01205 glBlendFunc(GL_ONE, GL_CONSTANT_ALPHA_EXT);
<a name="l01206"></a>01206 <span class="keywordflow">break</span>;
<a name="l01207"></a>01207 <span class="keywordflow">case</span> blender_mode_dodge:
<a name="l01208"></a>01208 glBlendFunc(GL_ONE, GL_CONSTANT_ALPHA_EXT);
<a name="l01209"></a>01209 <span class="keywordflow">break</span>;
<a name="l01210"></a>01210 }
<a name="l01211"></a>01211 }
<a name="l01212"></a>01212 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (mode == blender_mode_trans ||
<a name="l01213"></a>01213 mode == blender_mode_add ||
<a name="l01214"></a>01214 mode == blender_mode_burn ||
<a name="l01215"></a>01215 mode == blender_mode_dodge) {
<a name="l01216"></a>01216 <span class="comment">/* glBlendColor() is not available and it is needed by the selected</span>
<a name="l01217"></a>01217 <span class="comment"> * bledner. Bail out.*/</span>
<a name="l01218"></a>01218 <span class="keywordflow">return</span>;
<a name="l01219"></a>01219 }
<a name="l01220"></a>01220
<a name="l01221"></a>01221 <span class="comment">/* Check for presence of glBlendEquation(). */</span>
<a name="l01222"></a>01222 <span class="keywordflow">if</span> (<a class="code" href="group__extensions.html#ga7351f56ea1c4f4665193fc3bf547ff0a" title="This function is an helper to determine whether an OpenGL extension is available or not...">allegro_gl_is_extension_supported</a>(<span class="stringliteral">"GL_EXT_blend_minmax"</span>)) {
<a name="l01223"></a>01223 <span class="keywordflow">switch</span> (mode) {
<a name="l01224"></a>01224 <span class="keywordflow">case</span> blender_mode_none:
<a name="l01225"></a>01225 glBlendEquationEXT(GL_FUNC_ADD_EXT);
<a name="l01226"></a>01226 <span class="keywordflow">break</span>;
<a name="l01227"></a>01227 <span class="keywordflow">case</span> blender_mode_alpha:
<a name="l01228"></a>01228 glBlendEquationEXT(GL_FUNC_ADD_EXT);
<a name="l01229"></a>01229 <span class="keywordflow">break</span>;
<a name="l01230"></a>01230 <span class="keywordflow">case</span> blender_mode_trans:
<a name="l01231"></a>01231 glBlendEquationEXT(GL_FUNC_ADD_EXT);
<a name="l01232"></a>01232 <span class="keywordflow">break</span>;
<a name="l01233"></a>01233 <span class="keywordflow">case</span> blender_mode_add:
<a name="l01234"></a>01234 glBlendEquationEXT(GL_FUNC_ADD_EXT);
<a name="l01235"></a>01235 <span class="keywordflow">break</span>;
<a name="l01236"></a>01236 <span class="keywordflow">case</span> blender_mode_dodge:
<a name="l01237"></a>01237 glBlendEquationEXT(GL_FUNC_ADD_EXT);
<a name="l01238"></a>01238 <span class="keywordflow">break</span>;
<a name="l01239"></a>01239 <span class="keywordflow">case</span> blender_mode_multiply:
<a name="l01240"></a>01240 glBlendEquationEXT(GL_FUNC_ADD_EXT);
<a name="l01241"></a>01241 <span class="keywordflow">break</span>;
<a name="l01242"></a>01242 <span class="keywordflow">case</span> blender_mode_burn:
<a name="l01243"></a>01243 <span class="keywordflow">if</span> (<a class="code" href="group__extensions.html#ga7351f56ea1c4f4665193fc3bf547ff0a" title="This function is an helper to determine whether an OpenGL extension is available or not...">allegro_gl_is_extension_supported</a>(<span class="stringliteral">"GL_EXT_blend_subtract"</span>)) {
<a name="l01244"></a>01244 glBlendEquationEXT(GL_FUNC_SUBTRACT_EXT);
<a name="l01245"></a>01245 }
<a name="l01246"></a>01246 <span class="keywordflow">else</span> {
<a name="l01247"></a>01247 <span class="comment">/* GL_FUNC_SUBTRACT is not supported and it is needed by the</span>
<a name="l01248"></a>01248 <span class="comment"> * selected blender. Bail out. */</span>
<a name="l01249"></a>01249 <span class="keywordflow">return</span>;
<a name="l01250"></a>01250 }
<a name="l01251"></a>01251 <span class="keywordflow">break</span>;
<a name="l01252"></a>01252 }
<a name="l01253"></a>01253 }
<a name="l01254"></a>01254 }
<a name="l01255"></a>01255
<a name="l01256"></a>01256
<a name="l01257"></a>01257 <span class="preprocessor">#ifdef DEBUGMODE</span>
<a name="l01258"></a>01258 <span class="preprocessor"></span><span class="preprocessor">#ifdef LOGLEVEL</span>
<a name="l01259"></a>01259 <span class="preprocessor"></span>
<a name="l01260"></a>01260 <span class="keywordtype">void</span> __allegro_gl_log(<span class="keywordtype">int</span> level, <span class="keyword">const</span> <span class="keywordtype">char</span> *str)
<a name="l01261"></a>01261 {
<a name="l01262"></a>01262 <span class="keywordflow">if</span> (level <= LOGLEVEL)
<a name="l01263"></a>01263 TRACE(PREFIX_L <span class="stringliteral">"[%d] %s"</span>, level, str);
<a name="l01264"></a>01264 }
<a name="l01265"></a>01265
<a name="l01266"></a>01266 <span class="preprocessor">#endif</span>
<a name="l01267"></a>01267 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l01268"></a>01268 <span class="preprocessor"></span>
</pre></div></div>
</div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="alleggl_8c.html">alleggl.c</a> </li>
<li class="footer">Generated on Thu May 19 2011 23:20:20 for AllegroGL by 
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.3 </li>
</ul>
</div>
</body>
</html>
|