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
|
/*
* gldgStroke.c
*
* OpenGL Graph Display stroke font module implementation
*
* Written by: Shawn Taras
*/
#include <stdlib.h>
#include <math.h>
#include <GL/gl.h>
#include "glgd.h"
/*
* Static local (to this module) variables
*/
static glgdStroke *s_currentStroke = NULL;
static GLint s_blendFunc[2] = {GL_ONE, GL_ZERO};
/* ASCII Character tristrips drawn into a 16x16 pixel area
* --> NOTE! origin of 16x16 area is lower-left corner
*/
static const unsigned char s_g20[] =
{
0xff, 0xff
};
static const unsigned char s_g21[] =
{
0x60, 0x80, 0x62, 0x82, 0xff, 0x64, 0x84, 0x6e,
0x8e, 0xff, 0xff
};
static const unsigned char s_g22[] =
{
0x6a, 0x6e, 0x4c, 0x4e, 0xff, 0x8a, 0xac, 0x8e,
0xae, 0xff, 0xff
};
static const unsigned char s_g23[] =
{
0x42, 0x62, 0x44, 0x64, 0x46, 0x66, 0x48, 0x68,
0x4a, 0x6a, 0x4c, 0x6c, 0xff, 0x82, 0xa2, 0x84,
0xa4, 0x86, 0xa6, 0x88, 0xa8, 0x8a, 0xaa, 0x8c,
0xac, 0xff, 0x24, 0x44, 0x26, 0x46, 0xff, 0x64,
0x84, 0x66, 0x86, 0xff, 0xa4, 0xc4, 0xa6, 0xc6,
0xff, 0x28, 0x48, 0x2a, 0x4a, 0xff, 0x68, 0x88,
0x6a, 0x8a, 0xff, 0xa8, 0xc8, 0xaa, 0xca, 0xff,
0xff
};
static const unsigned char s_g24[] =
{
0x46, 0x48, 0x26, 0x38, 0x08, 0x29, 0x0a, 0x3a,
0x2c, 0x4a, 0x4c, 0xff, 0xa8, 0xa6, 0xc8, 0xb6,
0xe6, 0xc5, 0xe4, 0xb4, 0xc2, 0xa4, 0xa2, 0xff,
0x25, 0x04, 0x34, 0x22, 0x44, 0x42, 0xff, 0xc9,
0xea, 0xba, 0xcc, 0xaa, 0xac, 0xff, 0x40, 0x60,
0x42, 0x62, 0x44, 0x64, 0x46, 0x66, 0x48, 0x68,
0x4a, 0x6a, 0x4c, 0x6c, 0x4e, 0x6e, 0xff, 0x80,
0xa0, 0x82, 0xa2, 0x84, 0xa4, 0x86, 0xa6, 0x88,
0xa8, 0x8a, 0xaa, 0x8c, 0xac, 0x8e, 0xae, 0xff,
0x62, 0x82, 0x64, 0x84, 0xff, 0x66, 0x86, 0x68,
0x88, 0xff, 0x6a, 0x8a, 0x6c, 0x8c, 0xff, 0xff
};
static const unsigned char s_g25[] =
{
0x00, 0x20, 0x02, 0xec, 0xce, 0xee, 0xff, 0xa0,
0xb2, 0x82, 0xa3, 0x84, 0xb4, 0xa6, 0xc6, 0xff,
0xc6, 0xb4, 0xe4, 0xc3, 0xe2, 0xb2, 0xc0, 0xa0,
0xff, 0x28, 0x3a, 0x0a, 0x2b, 0x0c, 0x3c, 0x2e,
0x4e, 0xff, 0x4e, 0x3c, 0x6c, 0x4b, 0x6a, 0x3a,
0x48, 0x28, 0xff, 0xff
};
static const unsigned char s_g26[] =
{
0xa0, 0xe0, 0x91, 0xb3, 0x73, 0x95, 0x55, 0x77,
0x37, 0x59, 0x28, 0x4a, 0x2c, 0x4b, 0x4e, 0x5c,
0x6e, 0x6b, 0x8c, 0x6a, 0x88, 0x59, 0x77, 0xff,
0x91, 0x73, 0x80, 0x62, 0x20, 0x42, 0x02, 0x33,
0x04, 0x55, 0x37, 0xff, 0x95, 0xb3, 0xa6, 0xc4,
0xff, 0xff
};
static const unsigned char s_g27[] =
{
0x6a, 0x8c, 0x6e, 0x8e, 0xff, 0xff
};
static const unsigned char s_g28[] =
{
0x80, 0xa0, 0x62, 0x82, 0x6c, 0x8c, 0x8e, 0xae,
0xff, 0xff
};
static const unsigned char s_g29[] =
{
0x40, 0x60, 0x62, 0x82, 0x6c, 0x8c, 0x4e, 0x6e,
0xff, 0xff
};
static const unsigned char s_g2A[] =
{
0x77, 0xa8, 0x8a, 0xb9, 0x9b, 0xff, 0x77, 0x8a,
0x6a, 0x8c, 0x6c, 0xff, 0x77, 0x6a, 0x48, 0x5b,
0x39, 0xff, 0x77, 0x48, 0x46, 0x28, 0x26, 0xff,
0x77, 0x46, 0x64, 0x35, 0x53, 0xff, 0x77, 0x64,
0x84, 0x62, 0x82, 0xff, 0x77, 0x84, 0xa6, 0x93,
0xb5, 0xff, 0x77, 0xa6, 0xa8, 0xc6, 0xc8, 0xff,
0xff
};
static const unsigned char s_g2B[] =
{
0x62, 0x82, 0x66, 0x86, 0x88, 0xc6, 0xc8, 0xff,
0x8c, 0x6c, 0x88, 0x68, 0x66, 0x28, 0x26, 0xff,
0xff
};
static const unsigned char s_g2C[] =
{
0x84, 0x64, 0x82, 0x60, 0xff, 0xff
};
static const unsigned char s_g2D[] =
{
0x28, 0x26, 0xc8, 0xc6, 0xff, 0xff
};
static const unsigned char s_g2E[] =
{
0x60, 0x80, 0x62, 0x82, 0xff, 0xff
};
static const unsigned char s_g2F[] =
{
0x00, 0x20, 0x02, 0xec, 0xce, 0xee, 0xff, 0xff
};
static const unsigned char s_g30[] =
{
0x24, 0x42, 0xac, 0xca, 0xff, 0xb2, 0xc0, 0xc3,
0xe2, 0xca, 0xec, 0xac, 0xce, 0x3c, 0x2e, 0x2b,
0x0c, 0x24, 0x02, 0x42, 0x20, 0xb2, 0xc0, 0xff,
0xff
};
static const unsigned char s_g31[] =
{
0x80, 0xff, 0x4c, 0x4a, 0x6e, 0x6a, 0x8e, 0x60,
0x80, 0xff, 0xff
};
static const unsigned char s_g32[] =
{
0x0c, 0x2b, 0x2e, 0x3c, 0xce, 0xbc, 0xec, 0xcb,
0xe8, 0xc9, 0xc6, 0xb8, 0x36, 0x28, 0x25, 0x06,
0x22, 0x00, 0xe2, 0xe0, 0xff, 0xff
};
static const unsigned char s_g33[] =
{
0x0c, 0x2b, 0x2e, 0x3c, 0xce, 0xbc, 0xec, 0xcb,
0xe8, 0xc9, 0xd7, 0xb8, 0xb6, 0x68, 0x66, 0xff,
0xd7, 0xb6, 0xe6, 0xc5, 0xe2, 0xc3, 0xc0, 0xb2,
0x20, 0x32, 0x02, 0x23, 0xff, 0xff
};
static const unsigned char s_g34[] =
{
0xc6, 0xc8, 0x06, 0x28, 0x0c, 0x2c, 0xff, 0xc0,
0xe0, 0xc6, 0xe7, 0xc8, 0xee, 0xce, 0xff, 0xff
};
static const unsigned char s_g35[] =
{
0xec, 0xee, 0x2c, 0x0e, 0x29, 0x08, 0x38, 0x26,
0xc8, 0xb6, 0xe6, 0xc5, 0xe2, 0xc3, 0xc0, 0xb2,
0x20, 0x32, 0x02, 0x23, 0xff, 0xff
};
static const unsigned char s_g36[] =
{
0xcb, 0xec, 0xbc, 0xce, 0x3c, 0x2e, 0x2b, 0x0c,
0x28, 0x07, 0x26, 0x02, 0x23, 0x20, 0x32, 0xc0,
0xb2, 0xe2, 0xc3, 0xe6, 0xc5, 0xc8, 0xb6, 0x28,
0x26, 0xff, 0xff
};
static const unsigned char s_g37[] =
{
0x0e, 0x0c, 0xee, 0xbc, 0xec, 0x67, 0x86, 0x60,
0x80, 0xff, 0xff
};
static const unsigned char s_g38[] =
{
0x36, 0x17, 0x25, 0x06, 0x23, 0x02, 0x32, 0x20,
0xb2, 0xc0, 0xc3, 0xe2, 0xc5, 0xe6, 0xb6, 0xd7,
0xb8, 0xe8, 0xc9, 0xec, 0xcb, 0xce, 0xbc, 0x2e,
0x3c, 0x0c, 0x2b, 0x08, 0x29, 0x17, 0x38, 0x36,
0xb8, 0xb6, 0xff, 0xff
};
static const unsigned char s_g39[] =
{
0x23, 0x02, 0x32, 0x20, 0xb2, 0xc0, 0xc3, 0xe2,
0xc6, 0xe7, 0xc8, 0xec, 0xcb, 0xce, 0xbc, 0x2e,
0x3c, 0x0c, 0x2b, 0x08, 0x29, 0x26, 0x38, 0xc6,
0xc8, 0xff, 0xff
};
static const unsigned char s_g3A[] =
{
0x60, 0x80, 0x62, 0x82, 0xff, 0x66, 0x86, 0x68,
0x88, 0xff, 0xff
};
static const unsigned char s_g3B[] =
{
0x84, 0x64, 0x82, 0x60, 0xff, 0x66, 0x86, 0x68,
0x88, 0xff, 0xff
};
static const unsigned char s_g3C[] =
{
0xbc, 0x8c, 0x67, 0x37, 0xb2, 0x82, 0xff, 0xff
};
static const unsigned char s_g3D[] =
{
0x24, 0x26, 0xc4, 0xc6, 0xff, 0x28, 0x2a, 0xc8,
0xca, 0xff, 0xff
};
static const unsigned char s_g3E[] =
{
0x32, 0x62, 0x87, 0xb7, 0x3c, 0x6c, 0xff, 0xff
};
static const unsigned char s_g3F[] =
{
0x60, 0x80, 0x62, 0x82, 0xff, 0x64, 0x84, 0x65,
0xea, 0xcb, 0xec, 0xbc, 0xce, 0x3c, 0x2e, 0x2b,
0x0c, 0xff, 0xff
};
static const unsigned char s_g40[] =
{
0xe2, 0xc3, 0xc0, 0xb2, 0x20, 0x32, 0x02, 0x23,
0x0c, 0x2b, 0x2e, 0x3c, 0xce, 0xbc, 0xec, 0xcb,
0xe6, 0xc7, 0xc4, 0xb6, 0xa4, 0xa6, 0x84, 0x86,
0x64, 0x76, 0x46, 0x67, 0x48, 0x78, 0x6a, 0x88,
0xaa, 0x86, 0xa6, 0xff, 0xff
};
static const unsigned char s_g41[] =
{
0x00, 0x20, 0x08, 0x26, 0x38, 0xc6, 0xb8, 0xff,
0xc0, 0xe0, 0xc6, 0xe8, 0xb8, 0x8e, 0x7c, 0x6e,
0x38, 0x08, 0xff, 0xff
};
static const unsigned char s_g42[] =
{
0xb8, 0xd7, 0xc9, 0xe8, 0xcb, 0xec, 0xbc, 0xce,
0x2c, 0x0e, 0x28, 0x07, 0x26, 0x00, 0x22, 0xc0,
0xb2, 0xe2, 0xc3, 0xe6, 0xc5, 0xd7, 0xb6, 0xb8,
0x26, 0x28, 0xff, 0xff
};
static const unsigned char s_g43[] =
{
0xcb, 0xec, 0xbc, 0xce, 0x3c, 0x2e, 0x2b, 0x0c,
0x23, 0x02, 0x32, 0x20, 0xb2, 0xc0, 0xc3, 0xe2,
0xff, 0xff
};
static const unsigned char s_g44[] =
{
0x22, 0x00, 0xb2, 0xc0, 0xc3, 0xe2, 0xcb, 0xec,
0xbc, 0xce, 0x2c, 0x0e, 0x22, 0x00, 0xff, 0xff
};
static const unsigned char s_g45[] =
{
0xe0, 0xe2, 0x00, 0x22, 0x06, 0x26, 0x08, 0x28,
0x0e, 0x2c, 0xee, 0xec, 0xff, 0x28, 0x26, 0x88,
0x86, 0xff, 0xff
};
static const unsigned char s_g46[] =
{
0x00, 0x20, 0x06, 0x26, 0x08, 0x28, 0x0e, 0x2c,
0xee, 0xec, 0xff, 0x28, 0x26, 0x88, 0x86, 0xff,
0xff
};
static const unsigned char s_g47[] =
{
0xcb, 0xec, 0xbc, 0xce, 0x3c, 0x2e, 0x2b, 0x0c,
0x23, 0x02, 0x32, 0x20, 0xb2, 0xc0, 0xc3, 0xe2,
0xc6, 0xe8, 0x86, 0x88, 0xff, 0xff
};
static const unsigned char s_g48[] =
{
0x2e, 0x0e, 0x28, 0x07, 0x26, 0x00, 0x20, 0xff,
0xc0, 0xe0, 0xc6, 0xe7, 0xc8, 0xee, 0xce, 0xff,
0x28, 0x26, 0xc8, 0xc6, 0xff, 0xff
};
static const unsigned char s_g49[] =
{
0x42, 0x40, 0x62, 0x60, 0x82, 0x80, 0xa2, 0xa0,
0xff, 0x4e, 0x4c, 0x6e, 0x6c, 0x8e, 0x8c, 0xae,
0xac, 0xff, 0x62, 0x82, 0x6c, 0x8c, 0xff, 0xff
};
static const unsigned char s_g4A[] =
{
0x23, 0x02, 0x32, 0x20, 0xb2, 0xc0, 0xc3, 0xe2,
0xce, 0xee, 0xff, 0xff
};
static const unsigned char s_g4B[] =
{
0x2e, 0x0e, 0x28, 0x07, 0x26, 0x00, 0x20, 0xff,
0x28, 0x26, 0x68, 0x66, 0x97, 0xc0, 0xe2, 0xe0,
0xff, 0x68, 0x97, 0xce, 0xec, 0xee, 0xff, 0xff
};
static const unsigned char s_g4C[] =
{
0xe0, 0xe2, 0x00, 0x22, 0x0e, 0x2e, 0xff, 0xff
};
static const unsigned char s_g4D[] =
{
0x00, 0x20, 0x0e, 0x2b, 0x2e, 0x67, 0x79, 0x87,
0xce, 0xcb, 0xee, 0xc0, 0xe0, 0xff, 0xff
};
static const unsigned char s_g4E[] =
{
0x00, 0x20, 0x0e, 0x2b, 0x2e, 0xc0, 0xc3, 0xe0,
0xce, 0xee, 0xff, 0xff
};
static const unsigned char s_g4F[] =
{
0x23, 0x02, 0x32, 0x20, 0xb2, 0xc0, 0xc3, 0xe2,
0xcb, 0xec, 0xbc, 0xce, 0x3c, 0x2e, 0x2b, 0x0c,
0x23, 0x02, 0xff, 0xff
};
static const unsigned char s_g50[] =
{
0x00, 0x20, 0x06, 0x26, 0x08, 0x28, 0x0c, 0x2c,
0x0e, 0xbc, 0xce, 0xcb, 0xec, 0xc9, 0xe8, 0xb8,
0xc6, 0x28, 0x26, 0xff, 0xff
};
static const unsigned char s_g51[] =
{
0xc0, 0xe2, 0xc4, 0xec, 0xcb, 0xce, 0xbc, 0x2e,
0x3c, 0x0c, 0x2b, 0x02, 0x23, 0x20, 0x32, 0xc0,
0xa2, 0xc4, 0x84, 0xa6, 0xff, 0xff
};
static const unsigned char s_g52[] =
{
0xc0, 0xe0, 0xc5, 0xe6, 0xb6, 0xd7, 0xb8, 0xe8,
0xc9, 0xec, 0xcb, 0xce, 0xbc, 0x0e, 0x2c, 0x08,
0x28, 0x06, 0x26, 0x00, 0x20, 0xff, 0x28, 0x26,
0xb8, 0xb6, 0xff, 0xff
};
static const unsigned char s_g53[] =
{
0x23, 0x02, 0x32, 0x20, 0xb2, 0xc0, 0xc3, 0xe2,
0xc5, 0xe6, 0xb6, 0xc8, 0x26, 0x38, 0x08, 0x29,
0x0c, 0x2b, 0x2e, 0x3c, 0xce, 0xbc, 0xec, 0xcb,
0xff, 0xff
};
static const unsigned char s_g54[] =
{
0x0e, 0x0c, 0x6e, 0x6c, 0x8e, 0x8c, 0xee, 0xec,
0xff, 0x60, 0x80, 0x6c, 0x8c, 0xff, 0xff
};
static const unsigned char s_g55[] =
{
0x2e, 0x0e, 0x23, 0x02, 0x32, 0x20, 0xb2, 0xc0,
0xc3, 0xe2, 0xce, 0xee, 0xff, 0xff
};
static const unsigned char s_g56[] =
{
0x2e, 0x0e, 0x27, 0x06, 0x72, 0x60, 0xff, 0x60,
0x80, 0x72, 0xe6, 0xc7, 0xee, 0xce, 0xff, 0xff
};
static const unsigned char s_g57[] =
{
0xee, 0xce, 0xe0, 0xc3, 0xc0, 0x87, 0x75, 0x67,
0x20, 0x23, 0x00, 0x2e, 0x0e, 0xff, 0xff
};
static const unsigned char s_g58[] =
{
0x00, 0x20, 0x02, 0x75, 0x57, 0x97, 0x79, 0xec,
0xce, 0xee, 0xff, 0xe0, 0xe2, 0xc0, 0x97, 0x75,
0xff, 0x0e, 0x0c, 0x2e, 0x57, 0x79, 0xff, 0xff
};
static const unsigned char s_g59[] =
{
0x0e, 0x0c, 0x2e, 0x66, 0x79, 0x86, 0xce, 0xec,
0xee, 0xff, 0x60, 0x80, 0x66, 0x86, 0xff, 0xff
};
static const unsigned char s_g5A[] =
{
0x0e, 0x0c, 0xee, 0xbc, 0xec, 0x02, 0x32, 0x00,
0xe2, 0xe0, 0xff, 0xff
};
static const unsigned char s_g5B[] =
{
0xa0, 0xa2, 0x60, 0x82, 0x6e, 0x8c, 0xae, 0xac,
0xff, 0xff
};
static const unsigned char s_g5C[] =
{
0xe0, 0xe2, 0xc0, 0x2e, 0x0c, 0x0e, 0xff, 0xff
};
static const unsigned char s_g5D[] =
{
0x4e, 0x4c, 0x8e, 0x6c, 0x80, 0x62, 0x40, 0x42,
0xff, 0xff
};
static const unsigned char s_g5E[] =
{
0x3a, 0x6a, 0x7e, 0x7b, 0xba, 0x8a, 0xff, 0xff
};
static const unsigned char s_g5F[] =
{
0x02, 0x00, 0xe2, 0xe0, 0xff, 0xff
};
static const unsigned char s_g60[] =
{
0x8a, 0x8e, 0x6c, 0x6e, 0xff, 0xff
};
static const unsigned char s_g61[] =
{
0x08, 0x27, 0x2a, 0x38, 0xca, 0xb8, 0xe8, 0xc7,
0xe6, 0xc6, 0xe4, 0xc4, 0xe0, 0xc2, 0x20, 0x32,
0x02, 0x23, 0x04, 0x34, 0x26, 0xc4, 0xc6, 0xff,
0xff
};
static const unsigned char s_g62[] =
{
0x2e, 0x0e, 0x2a, 0x09, 0x28, 0x00, 0x22, 0xc0,
0xb2, 0xe2, 0xc3, 0xe8, 0xc7, 0xca, 0xb8, 0x2a,
0x28, 0xff, 0xff
};
static const unsigned char s_g63[] =
{
0xc7, 0xe8, 0xb8, 0xca, 0x38, 0x2a, 0x27, 0x08,
0x23, 0x02, 0x32, 0x20, 0xb2, 0xc0, 0xc3, 0xe2,
0xff, 0xff
};
static const unsigned char s_g64[] =
{
0xc8, 0xca, 0x38, 0x2a, 0x27, 0x08, 0x23, 0x02,
0x32, 0x20, 0xc2, 0xe0, 0xc8, 0xe9, 0xca, 0xee,
0xce, 0xff, 0xff
};
static const unsigned char s_g65[] =
{
0xe2, 0xc3, 0xc0, 0xb2, 0x20, 0x32, 0x02, 0x23,
0x04, 0x24, 0x06, 0x26, 0x08, 0x27, 0x2a, 0x38,
0xca, 0xb8, 0xe8, 0xc7, 0xe4, 0xc6, 0x24, 0x26,
0xff, 0xff
};
static const unsigned char s_g66[] =
{
0x4a, 0x48, 0x6a, 0x68, 0x8a, 0x88, 0xaa, 0xa8,
0xff, 0x60, 0x80, 0x68, 0x88, 0xff, 0x6a, 0x8a,
0x6c, 0x8b, 0x8e, 0x9c, 0xae, 0xac, 0xff, 0xff
};
static const unsigned char s_g67[] =
{
0x23, 0x02, 0x32, 0x20, 0xb2, 0xc0, 0xc3, 0xe2,
0xc4, 0xe6, 0xc6, 0xea, 0xc8, 0x2a, 0x38, 0x08,
0x27, 0x06, 0x36, 0x24, 0xc6, 0xc4, 0xff, 0xff
};
static const unsigned char s_g68[] =
{
0x00, 0x20, 0x08, 0x28, 0x0a, 0x2a, 0x0e, 0x2e,
0xff, 0x2a, 0x28, 0xca, 0xb8, 0xe8, 0xc7, 0xe0,
0xc0, 0xff, 0xff
};
static const unsigned char s_g69[] =
{
0x60, 0x80, 0x6a, 0x8a, 0xff, 0x6c, 0x8c, 0x6e,
0x8e, 0xff, 0xff
};
static const unsigned char s_g6A[] =
{
0x23, 0x02, 0x32, 0x20, 0xb2, 0xc0, 0xc3, 0xe2,
0xca, 0xea, 0xff, 0xcc, 0xec, 0xce, 0xee, 0xff,
0xff
};
static const unsigned char s_g6B[] =
{
0x00, 0x20, 0x04, 0x24, 0x06, 0x26, 0x0e, 0x2e,
0xff, 0x26, 0x24, 0x86, 0x84, 0xb5, 0xc0, 0xe2,
0xe0, 0xff, 0x86, 0xb5, 0xca, 0xe8, 0xea, 0xff,
0xff
};
static const unsigned char s_g6C[] =
{
0x60, 0x80, 0x6e, 0x8e, 0xff, 0xff
};
static const unsigned char s_g6D[] =
{
0x00, 0x20, 0x0a, 0x28, 0x6a, 0x68, 0xff, 0x60,
0x80, 0x68, 0x88, 0x6a, 0xb8, 0xca, 0xc7, 0xe8,
0xc0, 0xe0, 0xff, 0xff
};
static const unsigned char s_g6E[] =
{
0x00, 0x20, 0x0a, 0x28, 0xca, 0xb8, 0xe8, 0xc7,
0xe0, 0xc0, 0xff, 0xff
};
static const unsigned char s_g6F[] =
{
0x23, 0x02, 0x32, 0x20, 0xb2, 0xc0, 0xc3, 0xe2,
0xc7, 0xe8, 0xb8, 0xca, 0x38, 0x2a, 0x27, 0x08,
0x23, 0x02, 0xff, 0xff
};
static const unsigned char s_g70[] =
{
0x00, 0x20, 0x04, 0x24, 0x06, 0x26, 0x0a, 0x28,
0xca, 0xb8, 0xe8, 0xc7, 0xe6, 0xb6, 0xc4, 0x26,
0x24, 0xff, 0xff
};
static const unsigned char s_g71[] =
{
0xc0, 0xe0, 0xc4, 0xe5, 0xc6, 0xea, 0xc8, 0x2a,
0x38, 0x08, 0x27, 0x06, 0x36, 0x24, 0xc6, 0xc4,
0xff, 0xff
};
static const unsigned char s_g72[] =
{
0x00, 0x20, 0x0a, 0x28, 0xca, 0xb8, 0xe8, 0xc7,
0xff, 0xff
};
static const unsigned char s_g73[] =
{
0xc3, 0xe4, 0xb4, 0xc6, 0x24, 0x36, 0x06, 0x27,
0x08, 0x38, 0x2a, 0xb8, 0xca, 0xc7, 0xe8, 0xff,
0x23, 0x02, 0x32, 0x20, 0xb2, 0xc0, 0xc3, 0xe2,
0xe4, 0xff, 0xff
};
static const unsigned char s_g74[] =
{
0x4a, 0x48, 0x6a, 0x68, 0xff, 0x8a, 0x88, 0xaa,
0xa8, 0xff, 0xa0, 0xa2, 0x80, 0x92, 0x62, 0x83,
0x68, 0x88, 0x6a, 0x8a, 0x6c, 0x8c, 0xff, 0xff
};
static const unsigned char s_g75[] =
{
0x2a, 0x0a, 0x23, 0x02, 0x32, 0x20, 0xc2, 0xe0,
0xca, 0xea, 0xff, 0xff
};
static const unsigned char s_g76[] =
{
0xea, 0xca, 0xe6, 0xc7, 0x80, 0x72, 0x60, 0x27,
0x06, 0x2a, 0x0a, 0xff, 0xff
};
static const unsigned char s_g77[] =
{
0x2a, 0x0a, 0x22, 0x00, 0x52, 0x60, 0x63, 0x71,
0x83, 0x80, 0x92, 0xc0, 0xb2, 0xe2, 0xc3, 0xea,
0xca, 0xff, 0x8a, 0x6a, 0x83, 0x63, 0xff, 0xff
};
static const unsigned char s_g78[] =
{
0x00, 0x20, 0x02, 0x74, 0x45, 0x76, 0x08, 0x2a,
0x0a, 0xff, 0xea, 0xca, 0xe8, 0x76, 0xa5, 0x74,
0xe2, 0xc0, 0xe0, 0xff, 0xff
};
static const unsigned char s_g79[] =
{
0x23, 0x02, 0x32, 0x20, 0xb2, 0xc0, 0xc3, 0xe2,
0xc4, 0xe5, 0xc6, 0xea, 0xca, 0xff, 0x2a, 0x0a,
0x27, 0x06, 0x36, 0x24, 0xc6, 0xc4, 0xff, 0xff
};
static const unsigned char s_g7A[] =
{
0x0a, 0x08, 0xea, 0xa8, 0xe8, 0x02, 0x42, 0x00,
0xe2, 0xe0, 0xff, 0xff
};
static const unsigned char s_g7B[] =
{
0x80, 0xa0, 0x62, 0x82, 0x66, 0x86, 0x57, 0x77,
0x68, 0x88, 0x6c, 0x8c, 0x8e, 0xae, 0xff, 0xff
};
static const unsigned char s_g7C[] =
{
0x60, 0x80, 0x6f, 0x8f, 0xff, 0xff
};
static const unsigned char s_g7D[] =
{
0x6e, 0x4e, 0x8c, 0x6c, 0x88, 0x68, 0x97, 0x77,
0x86, 0x66, 0x82, 0x62, 0x60, 0x40, 0xff, 0xff
};
static const unsigned char s_g7E[] =
{
0xbc, 0xbe, 0x9a, 0x9c, 0x5c, 0x5e, 0x3a, 0x3c,
0xff, 0xff
};
static const unsigned char s_g7F[] =
{
0x44, 0x22, 0xa4, 0xc2, 0xaa, 0xcc, 0x4a, 0x2c,
0x44, 0x22, 0xff, 0xff
};
static const unsigned char *s_stroke[] =
{
s_g7F, s_g7F, s_g7F, s_g7F, s_g7F, s_g7F, s_g7F, s_g7F,
s_g7F, s_g7F, s_g7F, s_g7F, s_g7F, s_g7F, s_g7F, s_g7F,
s_g7F, s_g7F, s_g7F, s_g7F, s_g7F, s_g7F, s_g7F, s_g7F,
s_g7F, s_g7F, s_g7F, s_g7F, s_g7F, s_g7F, s_g7F, s_g7F,
s_g20, s_g21, s_g22, s_g23, s_g24, s_g25, s_g26, s_g27,
s_g28, s_g29, s_g2A, s_g2B, s_g2C, s_g2D, s_g2E, s_g2F,
s_g30, s_g31, s_g32, s_g33, s_g34, s_g35, s_g36, s_g37,
s_g38, s_g39, s_g3A, s_g3B, s_g3C, s_g3D, s_g3E, s_g3F,
s_g40, s_g41, s_g42, s_g43, s_g44, s_g45, s_g46, s_g47,
s_g48, s_g49, s_g4A, s_g4B, s_g4C, s_g4D, s_g4E, s_g4F,
s_g50, s_g51, s_g52, s_g53, s_g54, s_g55, s_g56, s_g57,
s_g58, s_g59, s_g5A, s_g5B, s_g5C, s_g5D, s_g5E, s_g5F,
s_g60, s_g61, s_g62, s_g63, s_g64, s_g65, s_g66, s_g67,
s_g68, s_g69, s_g6A, s_g6B, s_g6C, s_g6D, s_g6E, s_g6F,
s_g70, s_g71, s_g72, s_g73, s_g74, s_g75, s_g76, s_g77,
s_g78, s_g79, s_g7A, s_g7B, s_g7C, s_g7D, s_g7E, s_g7F
};
/*
* Static local (to this module) functions
*/
static void
glgdStrokePushAttributes(void)
{
glPushAttrib(GL_ENABLE_BIT);
glGetIntegerv(GL_BLEND_SRC, &s_blendFunc[0]);
glGetIntegerv(GL_BLEND_DST, &s_blendFunc[1]);
/* Common attributes for primitive drawing */
glDisable(GL_TEXTURE_2D);
glDisable(GL_LIGHTING);
glDisable(GL_DEPTH_TEST);
glDisable(GL_CULL_FACE);
}
static void
glgdStrokePopAttributes(void)
{
glPopAttrib();
glBlendFunc(s_blendFunc[0], s_blendFunc[1]);
}
/*
* External public functions
*/
glgdStroke
*glgdStrokeCreate(void)
{
glgdStroke *stroke;
stroke = (glgdStroke *)GLGD_MALLOC(sizeof(glgdStroke));
if (stroke)
{
glgdStrokeInit(stroke);
}
return stroke;
}
glgdStroke
*glgdStrokeDestroy(glgdStroke *stroke)
{
if (stroke)
{
GLGD_FREE(stroke);
}
return (glgdStroke *)NULL;
}
void
glgdStrokeInit(glgdStroke *stroke)
{
if (stroke)
{
stroke->flags = GLGDSTROKE_FLAG_INITIALIZED;
stroke->tabSize = GLGDSTROKE_TABSIZE_DEFAULT;
stroke->windowDim[0] = 640.0;
stroke->windowDim[1] = 480.0;
stroke->pointSize[0] = GLGDSTROKE_POINTSIZEX_DEFAULT;
stroke->pointSize[1] = GLGDSTROKE_POINTSIZEY_DEFAULT;
stroke->pos[0] = 0.0;
stroke->pos[1] = 0.0;
glgdStrokeClipFullWindow(stroke);
stroke->col[0] = 1.0;
stroke->col[1] = 1.0;
stroke->col[2] = 1.0;
stroke->col[3] = 1.0;
}
}
void
glgdStrokeFini(glgdStroke *stroke)
{
glgdStrokeInit(stroke);
}
glgdStroke
*glgdStrokeGetCurrent(void)
{
return s_currentStroke;
}
void
glgdStrokeSetCurrent(glgdStroke *stroke)
{
s_currentStroke = stroke;
}
int
glgdStrokePrint(glgdStroke *stroke, const char *fmt, ...)
{
int rc;
va_list args;
va_start(args, fmt);
rc = glgdStrokePrintVar(fmt, args);
va_end(args);
return rc;
}
int
glgdStrokePrintVar(const char *fmt, va_list ap)
{
int rc;
int vtxNdx;
char str[256];
char *c;
glgdStroke *stroke;
rc = 0;
stroke = glgdStrokeGetCurrent();
if (stroke)
{
/* Restrict string to 255 characters */
rc = vsnprintf(str, 255, fmt, ap);
/* Initialize the rendering */
glgdStrokePushAttributes();
glBegin(GL_TRIANGLE_STRIP);
/* Set the text color */
if (stroke->col[3] < 1.0)
{
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glColor4d(stroke->col[0], stroke->col[1],
stroke->col[2], stroke->col[3]);
}
else
{
glDisable(GL_BLEND);
glColor3d(stroke->col[0], stroke->col[1], stroke->col[2]);
}
/* Submit the vertices for the string */
vtxNdx = 0;
c = &str[0];
while (*c)
{
vtxNdx = glgdStrokeBuild(stroke, *c, vtxNdx);
c++;
}
glEnd();
glgdStrokePopAttributes();
}
return rc;
}
void
glgdStrokeTabSizeSet(glgdStroke *stroke, int tabSize)
{
if (stroke)
{
if (tabSize < 0)
{
stroke->tabSize = GLGDSTROKE_TABSIZE_DEFAULT;
}
else
{
stroke->tabSize = tabSize;
}
}
}
void
glgdStrokePointSizeSet(glgdStroke *stroke, glgdVec2 pointSize)
{
if (stroke)
{
if (pointSize[0] < 0.0 || pointSize[1] < 0.0)
{
stroke->pointSize[0] = GLGDSTROKE_POINTSIZEX_DEFAULT;
stroke->pointSize[1] = GLGDSTROKE_POINTSIZEY_DEFAULT;
}
else
{
stroke->pointSize[0] = pointSize[0];
stroke->pointSize[1] = pointSize[1];
}
}
}
void
glgdStrokePointSizeSetByList
(
glgdStroke *stroke,
GLdouble w,
GLdouble h
)
{
if (stroke)
{
if (w < 0.0 || h < 0.0)
{
stroke->pointSize[0] = GLGDSTROKE_POINTSIZEX_DEFAULT;
stroke->pointSize[1] = GLGDSTROKE_POINTSIZEY_DEFAULT;
}
else
{
stroke->pointSize[0] = w;
stroke->pointSize[1] = h;
}
}
}
void
glgdStrokePosSet(glgdStroke *stroke, glgdVec2 pos)
{
if (stroke)
{
stroke->pos[0] = pos[0];
stroke->pos[1] = pos[1];
}
}
void
glgdStrokePosSetByList(glgdStroke *stroke, GLdouble x, GLdouble y)
{
if (stroke)
{
stroke->pos[0] = x;
stroke->pos[1] = y;
}
}
void
glgdStrokeWindowDimSet(glgdStroke *stroke, glgdVec2 windowDim)
{
if (stroke)
{
stroke->windowDim[0] = windowDim[0];
stroke->windowDim[1] = windowDim[1];
}
}
void
glgdStrokeWindowDimSetByList(glgdStroke *stroke, GLdouble w, GLdouble h)
{
if (stroke)
{
stroke->windowDim[0] = w;
stroke->windowDim[1] = h;
}
}
void
glgdStrokeClipFullWindow(glgdStroke *stroke)
{
if (stroke)
{
stroke->clip[0] = 0.0;
stroke->clip[1] = 0.0;
stroke->clip[2] = stroke->windowDim[0];
stroke->clip[3] = stroke->windowDim[1];
}
}
void
glgdStrokeClipSet(glgdStroke *stroke, glgdVec4 clipRect)
{
if (stroke)
{
stroke->clip[0] = clipRect[0];
stroke->clip[1] = clipRect[1];
stroke->clip[2] = clipRect[2];
stroke->clip[3] = clipRect[3];
}
}
void
glgdStrokeClipSetByList
(
glgdStroke *stroke,
GLdouble x1,
GLdouble y1,
GLdouble x2,
GLdouble y2
)
{
if (stroke)
{
stroke->clip[0] = x1;
stroke->clip[1] = y1;
stroke->clip[2] = x2;
stroke->clip[3] = y2;
}
}
void
glgdStrokeColorSet(glgdStroke *stroke, glgdVec4 col)
{
if (stroke)
{
stroke->col[0] = col[0];
stroke->col[1] = col[1];
stroke->col[2] = col[2];
stroke->col[3] = col[3];
}
}
void
glgdStrokeColorSetByList
(
glgdStroke *stroke,
GLdouble r,
GLdouble g,
GLdouble b,
GLdouble a
)
{
if (stroke)
{
stroke->col[0] = r;
stroke->col[1] = g;
stroke->col[2] = b;
stroke->col[3] = a;
}
}
int
glgdStrokeBuild(glgdStroke *stroke, int charNdx, int ndx)
{
int i;
GLdouble sx, sy;
GLdouble x, y;
static glgdVec2 vtx;
if (!stroke)
{
return ndx;
}
if (charNdx < 0 || charNdx >= 128)
{
charNdx = 0;
}
if (charNdx == '\t')
{
stroke->pos[0] += stroke->pointSize[0] * stroke->tabSize;
return ndx;
}
else if (charNdx == '\n')
{
stroke->pos[0] = stroke->clip[0];
stroke->pos[1] += stroke->pointSize[1];
return ndx;
}
/* Compute the (x,y) position of the glyph */
x = stroke->pos[0];
y = stroke->pos[1];
/* Submit the vertices for this glyph */
i = 0;
sx = stroke->pointSize[0] * 0.0625;
sy = stroke->pointSize[1] * 0.0625;
while (s_stroke[charNdx][i] != 0xff)
{
/* Add degenerate triangle to link with next tri strip */
if (s_stroke[charNdx][i] != 0xff && ndx > 2)
{
/* Repeat last vertex */
glVertex2d(vtx[0], vtx[1]);
ndx++;
/* Submit this vertex */
vtx[0] = x + (s_stroke[charNdx][i] >> 4) * sx;
if (stroke->flags & GLGDSTROKE_FLAG_INVERT)
{
vtx[1] = y - (15 - (s_stroke[charNdx][i] % 16)) * sy;
}
else
{
vtx[1] = y + (15 - (s_stroke[charNdx][i] % 16)) * sy;
}
glVertex2d(vtx[0], vtx[1]);
ndx++;
}
while (s_stroke[charNdx][i] != 0xff)
{
vtx[0] = x + (s_stroke[charNdx][i] >> 4) * sx;
if (stroke->flags & GLGDSTROKE_FLAG_INVERT)
{
vtx[1] = y - (15 - (s_stroke[charNdx][i] % 16)) * sy;
}
else
{
vtx[1] = y + (15 - (s_stroke[charNdx][i] % 16)) * sy;
}
glVertex2d(vtx[0], vtx[1]);
ndx++;
i++;
}
i++;
}
/* Update the current position */
stroke->pos[0] += stroke->pointSize[0];
return ndx;
}
|