| 740 | } |
| 741 | |
| 742 | void Framework::displayInitialise() |
| 743 | { |
| 744 | if (!this->createWindow) |
| 745 | { |
| 746 | return; |
| 747 | } |
| 748 | LogInfo("Init display"); |
| 749 | int display_flags = SDL_WINDOW_OPENGL; |
| 750 | #ifdef OPENAPOC_GLES |
| 751 | SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_ES); |
| 752 | #else |
| 753 | #ifdef SDL_OPENGL_CORE |
| 754 | SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE); |
| 755 | #endif |
| 756 | |
| 757 | #endif |
| 758 | #ifdef DEBUG_RENDERER |
| 759 | SDL_GL_SetAttribute(SDL_GL_CONTEXT_FLAGS, SDL_GL_CONTEXT_DEBUG_FLAG); |
| 760 | #endif |
| 761 | // Request context version 3.0 |
| 762 | SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3); |
| 763 | SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 0); |
| 764 | // Request RGBA8888 - change if needed |
| 765 | SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8); |
| 766 | SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8); |
| 767 | SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8); |
| 768 | SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 8); |
| 769 | SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); |
| 770 | |
| 771 | SDL_GL_SetSwapInterval(Options::swapInterval.get()); |
| 772 | |
| 773 | ScreenMode mode = optionsScreenMode(); |
| 774 | if (mode == ScreenMode::Unknown) |
| 775 | { |
| 776 | LogError("Unknown screen mode specified: {%s}", Options::screenModeOption.get()); |
| 777 | mode = ScreenMode::Windowed; |
| 778 | } |
| 779 | |
| 780 | if (mode == ScreenMode::FullScreen) |
| 781 | display_flags |= SDL_WINDOW_FULLSCREEN; |
| 782 | else if (mode == ScreenMode::Borderless) |
| 783 | display_flags |= SDL_WINDOW_FULLSCREEN_DESKTOP; |
| 784 | |
| 785 | int displayNumber = Options::screenDisplayNumberOption.get(); |
| 786 | if (displayNumber >= SDL_GetNumVideoDisplays()) |
| 787 | { |
| 788 | LogWarning("Requested display number (%d) does not exist. Using display 0", displayNumber); |
| 789 | displayNumber = 0; |
| 790 | } |
| 791 | |
| 792 | int scrW = Options::screenWidthOption.get(); |
| 793 | int scrH = Options::screenHeightOption.get(); |
| 794 | |
| 795 | if (scrW < 640 || scrH < 480) |
| 796 | { |
| 797 | LogError( |
| 798 | "Requested display size of {%d,%d} is lower than {640,480} and probably won't work", |
| 799 | scrW, scrH); |
nothing calls this directly
no test coverage detected