Flips the screen
| 1666 | |
| 1667 | // Flips the screen |
| 1668 | void rend_Flip(void) { |
| 1669 | #ifndef RELEASE |
| 1670 | int i; |
| 1671 | |
| 1672 | RTP_INCRVALUE(texture_uploads, OpenGL_uploads); |
| 1673 | RTP_INCRVALUE(polys_drawn, OpenGL_polys_drawn); |
| 1674 | |
| 1675 | mprintf_at(1, 1, 0, "Uploads=%d Polys=%d Verts=%d ", OpenGL_uploads, OpenGL_polys_drawn, OpenGL_verts_processed); |
| 1676 | mprintf_at(1, 2, 0, "Sets= 0:%d 1:%d 2:%d 3:%d ", OpenGL_sets_this_frame[0], OpenGL_sets_this_frame[1], |
| 1677 | OpenGL_sets_this_frame[2], OpenGL_sets_this_frame[3]); |
| 1678 | mprintf_at(1, 3, 0, "Sets= 4:%d 5:%d ", OpenGL_sets_this_frame[4], OpenGL_sets_this_frame[5]); |
| 1679 | for (i = 0; i < 10; i++) { |
| 1680 | OpenGL_sets_this_frame[i] = 0; |
| 1681 | } |
| 1682 | #endif |
| 1683 | |
| 1684 | gpu_last_frame_polys_drawn = OpenGL_polys_drawn; |
| 1685 | gpu_last_frame_verts_processed = OpenGL_verts_processed; |
| 1686 | gpu_last_uploaded = OpenGL_uploads; |
| 1687 | |
| 1688 | OpenGL_uploads = 0; |
| 1689 | OpenGL_polys_drawn = 0; |
| 1690 | OpenGL_verts_processed = 0; |
| 1691 | |
| 1692 | // if we're rendering to an FBO, scale to the window framebuffer! |
| 1693 | if (GOpenGLFBO != 0) { |
| 1694 | int w, h; |
| 1695 | SDL_GL_GetDrawableSize(GSDLWindow, &w, &h); |
| 1696 | |
| 1697 | int scaledHeight, scaledWidth; |
| 1698 | if (w < h) { |
| 1699 | scaledWidth = w; |
| 1700 | scaledHeight = (int) (((((double)GOpenGLFBOHeight) / ((double)GOpenGLFBOWidth))) * ((double)w)); |
| 1701 | } else { |
| 1702 | scaledHeight = h; |
| 1703 | scaledWidth = (int) (((((double)GOpenGLFBOWidth) / ((double)GOpenGLFBOHeight))) * ((double)h)); |
| 1704 | } |
| 1705 | |
| 1706 | const int centeredX = (w - scaledWidth) / 2; |
| 1707 | const int centeredY = (h - scaledHeight) / 2; |
| 1708 | |
| 1709 | dglBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, 0); |
| 1710 | dglClearColor (0.0f, 0.0f, 0.0f, 1.0f); |
| 1711 | dglClear(GL_COLOR_BUFFER_BIT); // in case the Steam Overlay wrote to places we don't blit over. |
| 1712 | dglBlitFramebufferEXT(0, 0, GOpenGLFBOWidth, GOpenGLFBOHeight, |
| 1713 | centeredX, centeredY, centeredX + scaledWidth, centeredY + scaledHeight, |
| 1714 | GL_COLOR_BUFFER_BIT, GL_LINEAR); |
| 1715 | dglBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); |
| 1716 | } |
| 1717 | |
| 1718 | SDL_GL_SwapWindow(GSDLWindow); |
| 1719 | |
| 1720 | // go back to drawing on the FBO until we want to blit to the window framebuffer again. |
| 1721 | if (GOpenGLFBO != 0) { |
| 1722 | dglBindFramebufferEXT(GL_FRAMEBUFFER_EXT, GOpenGLFBO); |
| 1723 | dglViewport(0, 0, GOpenGLFBOWidth, GOpenGLFBOHeight); |
| 1724 | dglScissor(0, 0, GOpenGLFBOWidth, GOpenGLFBOHeight); |
| 1725 | } |
no outgoing calls
no test coverage detected