glViewport calls need to be in pixel coordinates.

This commit is contained in:
Henrik Rydgård 2012-11-20 16:48:24 +01:00
parent 4c2929cf13
commit 2a56d36b12
4 changed files with 22 additions and 11 deletions

View file

@ -49,8 +49,15 @@ struct CoreParameter
bool printfEmuLog; // writes "emulator:" logging to stdout
bool headLess; // Try to avoid messageboxes etc
// Internal PSP resolution
int renderWidth;
int renderHeight;
// Virtual (dpi-adjusted) output resolution
int outputWidth;
int outputHeight;
// Actual pixel output resolution (for use by glViewport and the like)
int pixelWidth;
int pixelHeight;
};

View file

@ -82,7 +82,7 @@ void GLES_GPU::InitClear()
// glClearColor(1,0,1,1);
glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
}
glViewport(0, 0, renderWidth_, renderHeight_);
glViewport(0, 0, PSP_CoreParameter().pixelWidth, PSP_CoreParameter().pixelHeight);
}
void GLES_GPU::BeginFrame()
@ -115,7 +115,7 @@ void GLES_GPU::CopyDisplayToOutput()
VirtualFramebuffer *vfb = GetDisplayFBO();
fbo_unbind();
glViewport(0, 0, PSP_CoreParameter().outputWidth, PSP_CoreParameter().outputHeight);
glViewport(0, 0, PSP_CoreParameter().pixelWidth, PSP_CoreParameter().pixelHeight);
currentRenderVfb_ = 0;

View file

@ -60,18 +60,20 @@ DWORD TheThread(LPVOID x)
INFO_LOG(BOOT, "Starting up hardware.");
CoreParameter coreParameter;
coreParameter.fileToStart = fileToStart;
coreParameter.enableSound = true;
coreParameter.gpuCore = GPU_GLES;
coreParameter.cpuCore = g_Config.bJIT ? CPU_JIT : CPU_INTERPRETER;
coreParameter.enableDebugging = true;
coreParameter.printfEmuLog = false;
coreParameter.headLess = false;
CoreParameter coreParameter;
coreParameter.fileToStart = fileToStart;
coreParameter.enableSound = true;
coreParameter.gpuCore = GPU_GLES;
coreParameter.cpuCore = g_Config.bJIT ? CPU_JIT : CPU_INTERPRETER;
coreParameter.enableDebugging = true;
coreParameter.printfEmuLog = false;
coreParameter.headLess = false;
coreParameter.renderWidth = 480 * g_Config.iWindowZoom;
coreParameter.renderHeight = 272 * g_Config.iWindowZoom;
coreParameter.outputWidth = 480 * g_Config.iWindowZoom;
coreParameter.outputHeight = 272 * g_Config.iWindowZoom;
coreParameter.pixelWidth = 480 * g_Config.iWindowZoom;
coreParameter.pixelHeight = 272 * g_Config.iWindowZoom;
std::string error_string;
if (!PSP_Init(coreParameter, &error_string))

View file

@ -65,6 +65,8 @@ EmuScreen::EmuScreen(const std::string &filename) : invalid_(true)
coreParam.renderHeight = 272;
coreParam.outputWidth = dp_xres;
coreParam.outputHeight = dp_yres;
coreParam.pixelWidth = pixel_xres;
coreParam.pixelHeight = pixel_yres;
std::string error_string;
if (PSP_Init(coreParam, &error_string)) {
@ -176,7 +178,7 @@ void EmuScreen::render()
uiTexture->Bind(0);
glViewport(0, 0, dp_xres, dp_yres);
glViewport(0, 0, pixel_xres, pixel_yres);
ui_draw2d.Begin(DBMODE_NORMAL);