Sets up our OpenGL rendering context Returns 1 if ok, 0 if something bad
| 618 | // Sets up our OpenGL rendering context |
| 619 | // Returns 1 if ok, 0 if something bad |
| 620 | int opengl_Init(oeApplication *app, renderer_preferred_state *pref_state) { |
| 621 | int width, height; |
| 622 | int retval = 1; |
| 623 | int i; |
| 624 | |
| 625 | mprintf(0, "Setting up opengl mode!\n"); |
| 626 | |
| 627 | if (pref_state) { |
| 628 | gpu_preferred_state = *pref_state; |
| 629 | } |
| 630 | |
| 631 | if (app != NULL) { |
| 632 | ParentApplication = app; |
| 633 | } |
| 634 | |
| 635 | int windowX = 0, windowY = 0; |
| 636 | |
| 637 | /*********************************************************** |
| 638 | * LINUX OPENGL |
| 639 | *********************************************************** |
| 640 | */ |
| 641 | // Setup gpu_state.screen_width & gpu_state.screen_height & width & height |
| 642 | width = gpu_preferred_state.width; |
| 643 | height = gpu_preferred_state.height; |
| 644 | |
| 645 | if (!opengl_Setup(app, &width, &height)) { |
| 646 | opengl_Close(); |
| 647 | return 0; |
| 648 | } |
| 649 | |
| 650 | memset(&gpu_state, 0, sizeof(rendering_state)); |
| 651 | gpu_state.screen_width = width; |
| 652 | gpu_state.screen_height = height; |
| 653 | |
| 654 | // Get some info |
| 655 | opengl_GetInformation(); |
| 656 | |
| 657 | mprintf(0, "Setting up multitexture...\n"); |
| 658 | |
| 659 | // Determine if Multitexture is supported |
| 660 | bool supportsMultiTexture = opengl_CheckExtension("GL_ARB_multitexture"); |
| 661 | if (!supportsMultiTexture) { |
| 662 | supportsMultiTexture = opengl_CheckExtension("GL_SGIS_multitexture"); |
| 663 | } |
| 664 | |
| 665 | if (FindArg("-NoMultitexture")) { |
| 666 | supportsMultiTexture = false; |
| 667 | } |
| 668 | |
| 669 | if (supportsMultiTexture) { |
| 670 | // attempt to grab Multitexture functions |
| 671 | opengl_GetDLLFunctions(); |
| 672 | } else { |
| 673 | // No multitexture at all |
| 674 | UseMultitexture = false; |
| 675 | } |
| 676 | |
| 677 | // Do we have packed pixel formats? |
no test coverage detected