comparison test/common.c @ 3408:55541ddf13e3

Support for GL initialization parameters has been added.
author Mike Gorchak <lestat@i.com.ua>
date Wed, 21 Oct 2009 14:51:42 +0000
parents 45f140dd4b08
children 4b594623401b
comparison
equal deleted inserted replaced
3407:d3baf5ac4e37 3408:55541ddf13e3
84 state->num_windows = 1; 84 state->num_windows = 1;
85 state->audiospec.freq = 22050; 85 state->audiospec.freq = 22050;
86 state->audiospec.format = AUDIO_S16; 86 state->audiospec.format = AUDIO_S16;
87 state->audiospec.channels = 2; 87 state->audiospec.channels = 2;
88 state->audiospec.samples = 2048; 88 state->audiospec.samples = 2048;
89
90 /* Set some very sane GL defaults */
91 state->gl_red_size = 3;
92 state->gl_green_size = 3;
93 state->gl_blue_size = 2;
94 state->gl_alpha_size = 0;
95 state->gl_buffer_size = 0;
96 state->gl_depth_size = 16;
97 state->gl_stencil_size = 0;
98 state->gl_double_buffer = 1;
99 state->gl_accum_red_size = 0;
100 state->gl_accum_green_size = 0;
101 state->gl_accum_blue_size = 0;
102 state->gl_accum_alpha_size = 0;
103 state->gl_stereo = 0;
104 state->gl_multisamplebuffers = 0;
105 state->gl_multisamplesamples = 0;
106 state->gl_retained_backing = 1;
107 state->gl_accelerated = 1;
108 state->gl_major_version = 2;
109 state->gl_minor_version = 1;
110
89 return state; 111 return state;
90 } 112 }
91 113
92 int 114 int
93 CommonArg(CommonState * state, int index) 115 CommonArg(CommonState * state, int index)
618 } 640 }
619 if (state->verbose & VERBOSE_VIDEO) { 641 if (state->verbose & VERBOSE_VIDEO) {
620 fprintf(stderr, "Video driver: %s\n", 642 fprintf(stderr, "Video driver: %s\n",
621 SDL_GetCurrentVideoDriver()); 643 SDL_GetCurrentVideoDriver());
622 } 644 }
645
646 /* Upload GL settings */
647 SDL_GL_SetAttribute(SDL_GL_RED_SIZE, state->gl_red_size);
648 SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, state->gl_green_size);
649 SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, state->gl_blue_size);
650 SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, state->gl_alpha_size);
651 SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, state->gl_double_buffer);
652 SDL_GL_SetAttribute(SDL_GL_BUFFER_SIZE, state->gl_buffer_size);
653 SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, state->gl_depth_size);
654 SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, state->gl_stencil_size);
655 SDL_GL_SetAttribute(SDL_GL_ACCUM_RED_SIZE, state->gl_accum_red_size);
656 SDL_GL_SetAttribute(SDL_GL_ACCUM_GREEN_SIZE, state->gl_accum_green_size);
657 SDL_GL_SetAttribute(SDL_GL_ACCUM_BLUE_SIZE, state->gl_accum_blue_size);
658 SDL_GL_SetAttribute(SDL_GL_ACCUM_ALPHA_SIZE, state->gl_accum_alpha_size);
659 SDL_GL_SetAttribute(SDL_GL_STEREO, state->gl_stereo);
660 SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, state->gl_multisamplebuffers);
661 SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, state->gl_multisamplesamples);
662 SDL_GL_SetAttribute(SDL_GL_ACCELERATED_VISUAL, state->gl_accelerated);
663 SDL_GL_SetAttribute(SDL_GL_RETAINED_BACKING, state->gl_retained_backing);
664 SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, state->gl_major_version);
665 SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, state->gl_minor_version);
623 666
624 if (state->verbose & VERBOSE_MODES) { 667 if (state->verbose & VERBOSE_MODES) {
625 SDL_DisplayMode mode; 668 SDL_DisplayMode mode;
626 int bpp; 669 int bpp;
627 Uint32 Rmask, Gmask, Bmask, Amask; 670 Uint32 Rmask, Gmask, Bmask, Amask;