| 832 | } |
| 833 | |
| 834 | SDL_bool |
| 835 | SDLTest_CommonInit(SDLTest_CommonState * state) |
| 836 | { |
| 837 | int i, j, m, n, w, h; |
| 838 | SDL_DisplayMode fullscreen_mode; |
| 839 | char text[1024]; |
| 840 | |
| 841 | if (state->flags & SDL_INIT_VIDEO) { |
| 842 | if (state->verbose & VERBOSE_VIDEO) { |
| 843 | n = SDL_GetNumVideoDrivers(); |
| 844 | if (n == 0) { |
| 845 | SDL_Log("No built-in video drivers\n"); |
| 846 | } else { |
| 847 | SDL_snprintf(text, sizeof(text), "Built-in video drivers:"); |
| 848 | for (i = 0; i < n; ++i) { |
| 849 | if (i > 0) { |
| 850 | SDL_snprintfcat(text, sizeof(text), ","); |
| 851 | } |
| 852 | SDL_snprintfcat(text, sizeof(text), " %s", SDL_GetVideoDriver(i)); |
| 853 | } |
| 854 | SDL_Log("%s\n", text); |
| 855 | } |
| 856 | } |
| 857 | if (SDL_VideoInit(state->videodriver) < 0) { |
| 858 | SDL_Log("Couldn't initialize video driver: %s\n", |
| 859 | SDL_GetError()); |
| 860 | return SDL_FALSE; |
| 861 | } |
| 862 | if (state->verbose & VERBOSE_VIDEO) { |
| 863 | SDL_Log("Video driver: %s\n", |
| 864 | SDL_GetCurrentVideoDriver()); |
| 865 | } |
| 866 | |
| 867 | /* Upload GL settings */ |
| 868 | SDL_GL_SetAttribute(SDL_GL_RED_SIZE, state->gl_red_size); |
| 869 | SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, state->gl_green_size); |
| 870 | SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, state->gl_blue_size); |
| 871 | SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, state->gl_alpha_size); |
| 872 | SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, state->gl_double_buffer); |
| 873 | SDL_GL_SetAttribute(SDL_GL_BUFFER_SIZE, state->gl_buffer_size); |
| 874 | SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, state->gl_depth_size); |
| 875 | SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, state->gl_stencil_size); |
| 876 | SDL_GL_SetAttribute(SDL_GL_ACCUM_RED_SIZE, state->gl_accum_red_size); |
| 877 | SDL_GL_SetAttribute(SDL_GL_ACCUM_GREEN_SIZE, state->gl_accum_green_size); |
| 878 | SDL_GL_SetAttribute(SDL_GL_ACCUM_BLUE_SIZE, state->gl_accum_blue_size); |
| 879 | SDL_GL_SetAttribute(SDL_GL_ACCUM_ALPHA_SIZE, state->gl_accum_alpha_size); |
| 880 | SDL_GL_SetAttribute(SDL_GL_STEREO, state->gl_stereo); |
| 881 | SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, state->gl_multisamplebuffers); |
| 882 | SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, state->gl_multisamplesamples); |
| 883 | if (state->gl_accelerated >= 0) { |
| 884 | SDL_GL_SetAttribute(SDL_GL_ACCELERATED_VISUAL, |
| 885 | state->gl_accelerated); |
| 886 | } |
| 887 | SDL_GL_SetAttribute(SDL_GL_RETAINED_BACKING, state->gl_retained_backing); |
| 888 | if (state->gl_major_version) { |
| 889 | SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, state->gl_major_version); |
| 890 | SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, state->gl_minor_version); |
| 891 | } |
no test coverage detected