diff --git a/test/context.c b/test/context.c index 9b5f6c1..81051c5 100644 --- a/test/context.c +++ b/test/context.c @@ -8,16 +8,15 @@ static SDL_GameController *s_controller; static int s_windowWidth; static int s_windowHeight; -void context_init( const char *title, int width, int height ) +void context_init( const char *title, int width, int height, int major, int minor ) { - if( SDL_Init( SDL_INIT_VIDEO | SDL_INIT_JOYSTICK ) < 0 ) goto err; + if( SDL_Init( SDL_INIT_VIDEO | SDL_INIT_JOYSTICK | SDL_INIT_AUDIO ) < 0 ) goto err; - SDL_GL_SetAttribute( SDL_GL_MULTISAMPLEBUFFERS, 1 ); - SDL_GL_SetAttribute( SDL_GL_MULTISAMPLESAMPLES, 4 ); - SDL_GL_SetAttribute( SDL_GL_CONTEXT_MAJOR_VERSION, 4 ); - SDL_GL_SetAttribute( SDL_GL_CONTEXT_MINOR_VERSION, 1 ); - SDL_GL_SetAttribute( SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE ); - SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 ); + int profile = (major < 3) ? SDL_GL_CONTEXT_PROFILE_COMPATIBILITY : SDL_GL_CONTEXT_PROFILE_CORE; + + SDL_GL_SetAttribute( SDL_GL_CONTEXT_MAJOR_VERSION, major ); + SDL_GL_SetAttribute( SDL_GL_CONTEXT_MINOR_VERSION, minor ); + SDL_GL_SetAttribute( SDL_GL_CONTEXT_PROFILE_MASK, profile ); SDL_GL_SetSwapInterval( 1 ); s_windowWidth = width; diff --git a/test/context.h b/test/context.h index fc7ea51..588e31f 100644 --- a/test/context.h +++ b/test/context.h @@ -8,13 +8,16 @@ #elif _WIN32 # define HAVE_M_PI # include -# include +# include #else # include # include #endif -extern void context_init( const char *title, int width, int height ); +extern int WINDOW_WIDTH; +extern int WINDOW_HEIGHT; + +extern void context_init( const char *title, int width, int height, int major, int minor ); extern bool context_flip_frame_poll_events( void ); extern SDL_GameController *context_get_controller( void ); extern void context_terminate( void ); \ No newline at end of file