MYST3: Fix the MVP matrix not being sent to OpenGL in some cases

Fixes #1308.
This commit is contained in:
Bastien Bouclet 2016-10-27 07:37:18 +02:00
parent 8339e2ef8f
commit 55d0a7f2c0
5 changed files with 15 additions and 25 deletions

View File

@ -158,7 +158,7 @@ public:
*/
virtual void selectTargetWindow(Window *window, bool is3D, bool scaled) = 0;
virtual void setupCameraPerspective(float pitch, float heading, float fov);
void setupCameraPerspective(float pitch, float heading, float fov);
bool isCubeFaceVisible(uint face);

View File

@ -104,7 +104,13 @@ void OpenGLRenderer::selectTargetWindow(Window *window, bool is3D, bool scaled)
glViewport(vp.left, _system->getHeight() - vp.top - vp.height(), vp.width(), vp.height());
}
if (!is3D) {
if (is3D) {
glMatrixMode(GL_PROJECTION);
glLoadMatrixf(_projectionMatrix.getData());
glMatrixMode(GL_MODELVIEW);
glLoadMatrixf(_modelViewMatrix.getData());
} else {
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
@ -129,16 +135,6 @@ void OpenGLRenderer::selectTargetWindow(Window *window, bool is3D, bool scaled)
}
}
void OpenGLRenderer::setupCameraPerspective(float pitch, float heading, float fov) {
Renderer::setupCameraPerspective(pitch, heading, fov);
glMatrixMode(GL_PROJECTION);
glLoadMatrixf(_projectionMatrix.getData());
glMatrixMode(GL_MODELVIEW);
glLoadMatrixf(_modelViewMatrix.getData());
}
void OpenGLRenderer::drawRect2D(const Common::Rect &rect, uint32 color) {
uint8 a, r, g, b;
Graphics::colorToARGB< Graphics::ColorMasks<8888> >(color, a, r, g, b);

View File

@ -40,7 +40,6 @@ public:
virtual void clear() override;
virtual void selectTargetWindow(Window *window, bool is3D, bool scaled) override;
virtual void setupCameraPerspective(float pitch, float heading, float fov) override;
Texture *createTexture(const Graphics::Surface *surface) override;
void freeTexture(Texture *texture) override;

View File

@ -109,7 +109,13 @@ void TinyGLRenderer::selectTargetWindow(Window *window, bool is3D, bool scaled)
//tglViewport(vp.left, _system->getHeight() - vp.top - vp.height(), vp.width(), vp.height());
}
if (!is3D) {
if (is3D) {
tglMatrixMode(TGL_PROJECTION);
tglLoadMatrixf(_projectionMatrix.getData());
tglMatrixMode(TGL_MODELVIEW);
tglLoadMatrixf(_modelViewMatrix.getData());
} else {
tglMatrixMode(TGL_PROJECTION);
tglLoadIdentity();
@ -134,16 +140,6 @@ void TinyGLRenderer::selectTargetWindow(Window *window, bool is3D, bool scaled)
}
}
void TinyGLRenderer::setupCameraPerspective(float pitch, float heading, float fov) {
Renderer::setupCameraPerspective(pitch, heading, fov);
tglMatrixMode(TGL_PROJECTION);
tglLoadMatrixf(_projectionMatrix.getData());
tglMatrixMode(TGL_MODELVIEW);
tglLoadMatrixf(_modelViewMatrix.getData());
}
void TinyGLRenderer::drawRect2D(const Common::Rect &rect, uint32 color) {
uint8 a, r, g, b;
Graphics::colorToARGB< Graphics::ColorMasks<8888> >(color, a, r, g, b);

View File

@ -41,7 +41,6 @@ public:
virtual void clear() override;
virtual void selectTargetWindow(Window *window, bool is3D, bool scaled) override;
virtual void setupCameraPerspective(float pitch, float heading, float fov) override;
Texture *createTexture(const Graphics::Surface *surface) override;
void freeTexture(Texture *texture) override;