summaryrefslogtreecommitdiff
path: root/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp
diff options
context:
space:
mode:
authorSonicadvance1 <sonicadvance1@gmail.com>2008-08-24 10:10:48 +0000
committerSonicadvance1 <sonicadvance1@gmail.com>2008-08-24 10:10:48 +0000
commit05cbb94cbb4eec4af39df8743731e7df0c48dffc (patch)
tree55f9351d6bba93591d44fec785c84bc8ed3090ca /Source/Plugins/Plugin_VideoOGL/Src/Render.cpp
parent98b9cfb2ded64d75118fc7d1fae3841af4e8fe4c (diff)
GL plugin now centers video output, you can set it to render to the full window and FPS can be shown. FPS and stretch to Window res is set in INI. Maybe also the window res actually changes correctly when resizing window in Windows?
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@287 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Plugins/Plugin_VideoOGL/Src/Render.cpp')
-rw-r--r--Source/Plugins/Plugin_VideoOGL/Src/Render.cpp37
1 files changed, 22 insertions, 15 deletions
diff --git a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp
index f029fc0221..653efee1f5 100644
--- a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp
+++ b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp
@@ -641,7 +641,6 @@ u32 Renderer::GetZBufferTarget()
{
return nZBufferRender > 0 ? s_ZBufferTarget : 0;
}
-
void Renderer::Swap(const TRectangle& rc)
{
OpenGL_Update(); // just updates the render window position and the backbuffer size
@@ -652,7 +651,7 @@ void Renderer::Swap(const TRectangle& rc)
// render to the real buffer now
glBindFramebufferEXT( GL_FRAMEBUFFER_EXT, 0 ); // switch to the backbuffer
- glViewport(0, 0, nBackbufferWidth, nBackbufferHeight);
+ glViewport(nXoff, nYoff, nBackbufferWidth, nBackbufferHeight);
ResetGLState();
@@ -674,23 +673,22 @@ void Renderer::Swap(const TRectangle& rc)
glBindTexture(GL_TEXTURE_RECTANGLE_NV, 0);
TextureMngr::DisableStage(0);
-// static int fpscount = 0;
-// static float s_fps = 0;
-// static u32 lasttime = timeGetTime();
-//
-// if( ++fpscount >= 16 ) {
-// s_fps = 16*1000.0f/(float)(timeGetTime() - lasttime);
-// lasttime = timeGetTime();
-// fpscount = 0;
-// }
-//
-// char strfps[25];
-// sprintf(strfps, "fps: %2.1f\n", s_fps);
-// Renderer::RenderText(strfps, 20, 20, 0xFF00FFFF);
+ static int fpscount;
+ static int s_fps;
+ static unsigned long lasttime;
+ ++fpscount;
+ if( timeGetTime() - lasttime > 1000 )
+ {
+ lasttime = timeGetTime();
+ s_fps = fpscount;
+ fpscount = 0;
+ }
if (g_Config.bOverlayStats) {
char st[2048];
char *p = st;
+ if(g_Config.bShowFPS)
+ p+=sprintf(p, "FPS: %d\n", s_fps); // So it shows up before the stats and doesn't make anyting ugly
p+=sprintf(p,"Num textures created: %i\n",stats.numTexturesCreated);
p+=sprintf(p,"Num textures alive: %i\n",stats.numTexturesAlive);
p+=sprintf(p,"Num pshaders created: %i\n",stats.numPixelShadersCreated);
@@ -715,6 +713,15 @@ void Renderer::Swap(const TRectangle& rc)
Renderer::RenderText(st, 20, 20, 0xFF00FFFF);
}
+ else
+ {
+ if(g_Config.bShowFPS)
+ {
+ char strfps[25];
+ sprintf(strfps, "%d\n", s_fps);
+ Renderer::RenderText(strfps, 20, 20, 0xFF00FFFF);
+ }
+ }
Renderer::ProcessMessages();