| 629 | |
| 630 | |
| 631 | VGLFBConfig *configsFromVisAttribs(Display *dpy, int screen, |
| 632 | const int attribs[], int &nElements, bool glx13) |
| 633 | { |
| 634 | int glxattribs[MAX_ATTRIBS + 1], j = 0; |
| 635 | int doubleBuffer = glx13 ? -1 : 0, redSize = -1, greenSize = -1, |
| 636 | blueSize = -1, alphaSize = -1, samples = -1, stereo = 0, |
| 637 | renderType = glx13 ? -1 : GLX_COLOR_INDEX_BIT, |
| 638 | drawableType = glx13 ? -1 : GLX_WINDOW_BIT | GLX_PIXMAP_BIT, |
| 639 | visualType = -1; |
| 640 | |
| 641 | for(int i = 0; attribs[i] != None && i < MAX_ATTRIBS; i++) |
| 642 | { |
| 643 | if(attribs[i] == GLX_DOUBLEBUFFER) |
| 644 | { |
| 645 | if(glx13) { doubleBuffer = attribs[i + 1]; i++; } |
| 646 | else doubleBuffer = 1; |
| 647 | } |
| 648 | else if(attribs[i] == GLX_RGBA && !glx13) renderType = GLX_RGBA_BIT; |
| 649 | else if(attribs[i] == GLX_RENDER_TYPE && glx13) |
| 650 | { |
| 651 | renderType = attribs[i + 1]; i++; |
| 652 | } |
| 653 | else if(attribs[i] == GLX_LEVEL) |
| 654 | { |
| 655 | if(attribs[i + 1] != 0) return NULL; |
| 656 | i++; |
| 657 | } |
| 658 | else if(attribs[i] == GLX_STEREO) |
| 659 | { |
| 660 | if(glx13) { stereo = attribs[i + 1]; i++; } |
| 661 | else stereo = 1; |
| 662 | } |
| 663 | else if(attribs[i] == GLX_RED_SIZE) |
| 664 | { |
| 665 | redSize = attribs[i + 1]; i++; |
| 666 | } |
| 667 | else if(attribs[i] == GLX_GREEN_SIZE) |
| 668 | { |
| 669 | greenSize = attribs[i + 1]; i++; |
| 670 | } |
| 671 | else if(attribs[i] == GLX_BLUE_SIZE) |
| 672 | { |
| 673 | blueSize = attribs[i + 1]; i++; |
| 674 | } |
| 675 | else if(attribs[i] == GLX_ALPHA_SIZE) |
| 676 | { |
| 677 | alphaSize = attribs[i + 1]; i++; |
| 678 | } |
| 679 | else if(attribs[i] == GLX_TRANSPARENT_TYPE) |
| 680 | { |
| 681 | if(attribs[i + 1] != GLX_NONE) return NULL; |
| 682 | i++; |
| 683 | } |
| 684 | else if(attribs[i] == GLX_SAMPLES) |
| 685 | { |
| 686 | samples = attribs[i + 1]; i++; |
| 687 | } |
| 688 | else if(attribs[i] == GLX_X_VISUAL_TYPE) |
no test coverage detected