static int GL_UpdateViewport(SDL_Renderer * renderer) { GL_RenderData *data = (GL_RenderData *) renderer->driverdata; if (SDL_CurrentContext != data->context) { /* We'll update the viewport after we rebind the context */ return 0; } data->glViewport(renderer->viewport.x, renderer->viewport.y, renderer->viewport.w, renderer->viewport.h); data->glMatrixMode(GL_PROJECTION); data->glLoadIdentity(); data->glOrtho((GLdouble) 0, (GLdouble) renderer->viewport.w, (GLdouble) renderer->viewport.h, (GLdouble) 0, 0.0, 1.0); return 0; }
/* This is called if we need to invalidate all of the SDL OpenGL state */ static void GL_ResetState(SDL_Renderer *renderer) { GL_RenderData *data = (GL_RenderData *) renderer->driverdata; if (SDL_CurrentContext == data->context) { GL_UpdateViewport(renderer); } else { GL_ActivateRenderer(renderer); } data->current.shader = SHADER_NONE; data->current.color = 0; data->current.blendMode = -1; data->glDisable(GL_DEPTH_TEST); data->glDisable(GL_CULL_FACE); /* This ended up causing video discrepancies between OpenGL and Direct3D */ /*data->glEnable(GL_LINE_SMOOTH);*/ data->glMatrixMode(GL_MODELVIEW); data->glLoadIdentity(); }