SDL: rebuild all GL textures when the core changes resolutions. [R. Belmont]

This commit is contained in:
R. Belmont 2014-07-17 03:51:46 +00:00
parent a67784f335
commit 1ecab6cb9a
2 changed files with 32 additions and 0 deletions

View File

@ -570,6 +570,9 @@ static int drawogl_window_create(sdl_window_info *window, int width, int height)
window->width = sdl->sdlsurf->w; window->width = sdl->sdlsurf->w;
window->height = sdl->sdlsurf->h; window->height = sdl->sdlsurf->h;
window->screen_width = 0;
window->screen_height = 0;
if ( (video_config.mode == VIDEO_MODE_OPENGL) && !(sdl->sdlsurf->flags & SDL_OPENGL) ) if ( (video_config.mode == VIDEO_MODE_OPENGL) && !(sdl->sdlsurf->flags & SDL_OPENGL) )
{ {
osd_printf_error("OpenGL not supported on this driver!\n"); osd_printf_error("OpenGL not supported on this driver!\n");
@ -763,6 +766,7 @@ static void drawogl_window_resize(sdl_window_info *window, int width, int height
sdl->sdlsurf = SDL_SetVideoMode(width, height, 0, sdl->sdlsurf = SDL_SetVideoMode(width, height, 0,
SDL_SWSURFACE | SDL_ANYFORMAT | sdl->extra_flags); SDL_SWSURFACE | SDL_ANYFORMAT | sdl->extra_flags);
window->width = sdl->sdlsurf->w; window->width = sdl->sdlsurf->w;
window->height = sdl->sdlsurf->h; window->height = sdl->sdlsurf->h;
#endif #endif
@ -1136,7 +1140,32 @@ static int drawogl_window_draw(sdl_window_info *window, UINT32 dc, int update)
#if (SDLMAME_SDL2) #if (SDLMAME_SDL2)
SDL_GL_MakeCurrent(window->sdl_window, sdl->gl_context_id); SDL_GL_MakeCurrent(window->sdl_window, sdl->gl_context_id);
#else
if (!sdl->init_context)
{
screen_device_iterator myiter(window->machine().root_device());
for (screen = myiter.first(); screen != NULL; screen = myiter.next())
{
if (window->index == 0)
{
if ((screen->width() != window->screen_width) || (screen->height() != window->screen_height))
{
window->screen_width = screen->width();
window->screen_height = screen->height();
// force all textures to be regenerated
drawogl_destroy_all_textures(window);
}
break;
}
else
{
scrnum++;
}
}
}
#endif #endif
if (sdl->init_context) if (sdl->init_context)
{ {
// do some one-time OpenGL setup // do some one-time OpenGL setup

View File

@ -96,6 +96,9 @@ struct sdl_window_info
int resize_width; int resize_width;
int resize_height; int resize_height;
osd_ticks_t last_resize; osd_ticks_t last_resize;
#else
int screen_width;
int screen_height;
#endif #endif
}; };