Skip to content

Commit

Permalink
Allow OpenGL rendering to resize.
Browse files Browse the repository at this point in the history
  • Loading branch information
icculus committed Jun 24, 2011
1 parent c070ce8 commit 887e339
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion test/sdltheoraplay.c
Expand Up @@ -445,7 +445,7 @@ static void playfile(const char *fname, const THEORAPLAY_VideoFormat vidfmt,

if (has_video)
{
const Uint32 flags = opengl ? SDL_OPENGL : 0;
const Uint32 flags = opengl ? (SDL_OPENGL|SDL_RESIZABLE) : 0;
const Uint32 overlayfmt = sdlyuvfmt(vidfmt);
planar = (overlayfmt != 0);
framems = (video->fps == 0.0) ? 0 : ((Uint32) (1000.0 / video->fps));
Expand Down Expand Up @@ -701,6 +701,20 @@ static void playfile(const char *fname, const THEORAPLAY_VideoFormat vidfmt,
SDL_Rect dstrect = { 0, 0, screen->w, screen->h };
SDL_DisplayYUVOverlay(overlay, &dstrect);
} // if
else if (opengl)
{
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
SDL_GL_SwapBuffers();
} // else if
break;

case SDL_VIDEORESIZE:
assert(opengl);
screen = SDL_SetVideoMode(event.resize.w, event.resize.h, 0, SDL_OPENGL|SDL_RESIZABLE);
glViewport(0, 0, event.resize.w, event.resize.h);
glScissor(0, 0, event.resize.w, event.resize.h);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
SDL_GL_SwapBuffers();
break;

case SDL_QUIT:
Expand Down

0 comments on commit 887e339

Please sign in to comment.