|
|
@ -712,27 +712,73 @@ void GL_SwapBuffers() |
|
|
|
SDL_GL_SwapWindow( host.hWnd ); |
|
|
|
SDL_GL_SwapWindow( host.hWnd ); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int GL_SetAttribute( int attr, int val ) |
|
|
|
int GL_SetAttribute( int attr, int val ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
switch( attr ) |
|
|
|
switch( attr ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
#define MAP_REF_API_ATTRIBUTE_TO_SDL( name ) case REF_##name: return SDL_GL_SetAttribute( SDL_##name, val ); |
|
|
|
|
|
|
|
MAP_REF_API_ATTRIBUTE_TO_SDL( GL_RED_SIZE ); |
|
|
|
|
|
|
|
MAP_REF_API_ATTRIBUTE_TO_SDL( GL_GREEN_SIZE ); |
|
|
|
|
|
|
|
MAP_REF_API_ATTRIBUTE_TO_SDL( GL_BLUE_SIZE ); |
|
|
|
|
|
|
|
MAP_REF_API_ATTRIBUTE_TO_SDL( GL_ALPHA_SIZE ); |
|
|
|
|
|
|
|
MAP_REF_API_ATTRIBUTE_TO_SDL( GL_DOUBLEBUFFER ); |
|
|
|
|
|
|
|
MAP_REF_API_ATTRIBUTE_TO_SDL( GL_DEPTH_SIZE ); |
|
|
|
|
|
|
|
MAP_REF_API_ATTRIBUTE_TO_SDL( GL_STENCIL_SIZE ); |
|
|
|
|
|
|
|
MAP_REF_API_ATTRIBUTE_TO_SDL( GL_MULTISAMPLEBUFFERS ); |
|
|
|
|
|
|
|
MAP_REF_API_ATTRIBUTE_TO_SDL( GL_MULTISAMPLESAMPLES ); |
|
|
|
|
|
|
|
MAP_REF_API_ATTRIBUTE_TO_SDL( GL_ACCELERATED_VISUAL ); |
|
|
|
|
|
|
|
MAP_REF_API_ATTRIBUTE_TO_SDL( GL_CONTEXT_MAJOR_VERSION ); |
|
|
|
|
|
|
|
MAP_REF_API_ATTRIBUTE_TO_SDL( GL_CONTEXT_MINOR_VERSION ); |
|
|
|
|
|
|
|
MAP_REF_API_ATTRIBUTE_TO_SDL( GL_CONTEXT_EGL ); |
|
|
|
|
|
|
|
MAP_REF_API_ATTRIBUTE_TO_SDL( GL_CONTEXT_FLAGS ); |
|
|
|
|
|
|
|
MAP_REF_API_ATTRIBUTE_TO_SDL( GL_SHARE_WITH_CURRENT_CONTEXT ); |
|
|
|
|
|
|
|
MAP_REF_API_ATTRIBUTE_TO_SDL( GL_FRAMEBUFFER_SRGB_CAPABLE ); |
|
|
|
|
|
|
|
MAP_REF_API_ATTRIBUTE_TO_SDL( GL_CONTEXT_RELEASE_BEHAVIOR ); |
|
|
|
|
|
|
|
MAP_REF_API_ATTRIBUTE_TO_SDL( GL_CONTEXT_RESET_NOTIFICATION ); |
|
|
|
|
|
|
|
MAP_REF_API_ATTRIBUTE_TO_SDL( GL_CONTEXT_NO_ERROR ); |
|
|
|
case REF_GL_CONTEXT_PROFILE_MASK: |
|
|
|
case REF_GL_CONTEXT_PROFILE_MASK: |
|
|
|
#ifdef SDL_HINT_OPENGL_ES_DRIVER |
|
|
|
#ifdef SDL_HINT_OPENGL_ES_DRIVER |
|
|
|
if( val == REF_GL_CONTEXT_PROFILE_ES ) |
|
|
|
if (val == REF_GL_CONTEXT_PROFILE_ES) |
|
|
|
SDL_SetHint( SDL_HINT_OPENGL_ES_DRIVER, "1" ); |
|
|
|
SDL_SetHint(SDL_HINT_OPENGL_ES_DRIVER, "1"); |
|
|
|
#endif // SDL_HINT_OPENGL_ES_DRIVER
|
|
|
|
#endif // SDL_HINT_OPENGL_ES_DRIVER
|
|
|
|
break; |
|
|
|
return SDL_GL_SetAttribute( SDL_GL_CONTEXT_PROFILE_MASK, val ); |
|
|
|
default: |
|
|
|
#undef MAP_REF_API_ATTRIBUTE_TO_SDL |
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return SDL_GL_SetAttribute( (SDL_GLattr)attr, val ); |
|
|
|
ASSERT( 0 ); |
|
|
|
|
|
|
|
return -1; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
int GL_GetAttribute( int attr, int *val ) |
|
|
|
int GL_GetAttribute( int attr, int *val ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
return SDL_GL_GetAttribute( (SDL_GLattr)attr, val ); |
|
|
|
switch( attr ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
#define MAP_REF_API_ATTRIBUTE_TO_SDL( name ) case REF_##name: return SDL_GL_GetAttribute( SDL_##name, val ); |
|
|
|
|
|
|
|
MAP_REF_API_ATTRIBUTE_TO_SDL( GL_RED_SIZE ); |
|
|
|
|
|
|
|
MAP_REF_API_ATTRIBUTE_TO_SDL( GL_GREEN_SIZE ); |
|
|
|
|
|
|
|
MAP_REF_API_ATTRIBUTE_TO_SDL( GL_BLUE_SIZE ); |
|
|
|
|
|
|
|
MAP_REF_API_ATTRIBUTE_TO_SDL( GL_ALPHA_SIZE ); |
|
|
|
|
|
|
|
MAP_REF_API_ATTRIBUTE_TO_SDL( GL_DOUBLEBUFFER ); |
|
|
|
|
|
|
|
MAP_REF_API_ATTRIBUTE_TO_SDL( GL_DEPTH_SIZE ); |
|
|
|
|
|
|
|
MAP_REF_API_ATTRIBUTE_TO_SDL( GL_STENCIL_SIZE ); |
|
|
|
|
|
|
|
MAP_REF_API_ATTRIBUTE_TO_SDL( GL_MULTISAMPLEBUFFERS ); |
|
|
|
|
|
|
|
MAP_REF_API_ATTRIBUTE_TO_SDL( GL_MULTISAMPLESAMPLES ); |
|
|
|
|
|
|
|
MAP_REF_API_ATTRIBUTE_TO_SDL( GL_ACCELERATED_VISUAL ); |
|
|
|
|
|
|
|
MAP_REF_API_ATTRIBUTE_TO_SDL( GL_CONTEXT_MAJOR_VERSION ); |
|
|
|
|
|
|
|
MAP_REF_API_ATTRIBUTE_TO_SDL( GL_CONTEXT_MINOR_VERSION ); |
|
|
|
|
|
|
|
MAP_REF_API_ATTRIBUTE_TO_SDL( GL_CONTEXT_EGL ); |
|
|
|
|
|
|
|
MAP_REF_API_ATTRIBUTE_TO_SDL( GL_CONTEXT_FLAGS ); |
|
|
|
|
|
|
|
MAP_REF_API_ATTRIBUTE_TO_SDL( GL_SHARE_WITH_CURRENT_CONTEXT ); |
|
|
|
|
|
|
|
MAP_REF_API_ATTRIBUTE_TO_SDL( GL_FRAMEBUFFER_SRGB_CAPABLE ); |
|
|
|
|
|
|
|
MAP_REF_API_ATTRIBUTE_TO_SDL( GL_CONTEXT_RELEASE_BEHAVIOR ); |
|
|
|
|
|
|
|
MAP_REF_API_ATTRIBUTE_TO_SDL( GL_CONTEXT_RESET_NOTIFICATION ); |
|
|
|
|
|
|
|
MAP_REF_API_ATTRIBUTE_TO_SDL( GL_CONTEXT_NO_ERROR ); |
|
|
|
|
|
|
|
MAP_REF_API_ATTRIBUTE_TO_SDL( GL_CONTEXT_PROFILE_MASK ); |
|
|
|
|
|
|
|
#undef MAP_REF_API_ATTRIBUTE_TO_SDL |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ASSERT( 0 ); |
|
|
|
|
|
|
|
return 0; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
#ifndef EGL_LIB |
|
|
|
#ifndef EGL_LIB |
|
|
|