From 992e42f9d8c68f44479b948d700107da34a861b6 Mon Sep 17 00:00:00 2001 From: otya128 Date: Wed, 14 Dec 2016 21:07:03 +0900 Subject: [PATCH] Fix sprite rendering --- SMILEBASIC/petitcomputer.d | 2 +- SMILEBASIC/sprite.d | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/SMILEBASIC/petitcomputer.d b/SMILEBASIC/petitcomputer.d index e766d97..aac5db4 100644 --- a/SMILEBASIC/petitcomputer.d +++ b/SMILEBASIC/petitcomputer.d @@ -392,7 +392,7 @@ class PetitComputer glViewport2(x + currentDisplay.rect[i].x, currentDisplay.yoffset - h - y - currentDisplay.rect[i].y, w, h); glMatrixMode(GL_PROJECTION); glLoadIdentity(); - glOrtho(x, x + w, y + h, y, 1024, -2048); + glOrtho(x, x + w - 1, y + h - 1, y, 1024, -2048); } Button[] buttonTable; Sprite sprite; diff --git a/SMILEBASIC/sprite.d b/SMILEBASIC/sprite.d index 0822211..c2a18f6 100644 --- a/SMILEBASIC/sprite.d +++ b/SMILEBASIC/sprite.d @@ -701,6 +701,7 @@ class Sprite disw = petitcom.currentDisplay.rect[1].w / 2; disw2 = petitcom.currentDisplay.rect[1].w; petitcom.chRenderingDisplay(1, clipRect[1].x, clipRect[1].y, clipRect[1].w, clipRect[1].h); + glMatrixMode(GL_MODELVIEW); aspect = disw2 / dish2; texture = petitcom.graphic.GRP[sppage[1]].glTexture; glBindTexture(GL_TEXTURE_2D, texture); @@ -715,6 +716,7 @@ class Sprite disw = petitcom.currentDisplay.rect[0].w / 2; disw2 = petitcom.currentDisplay.rect[0].w; petitcom.chRenderingDisplay(0, clipRect[0].x, clipRect[0].y, clipRect[0].w, clipRect[0].h); + glMatrixMode(GL_MODELVIEW); aspect = disw2 / dish2; texture = petitcom.graphic.GRP[sppage[0]].glTexture; glBindTexture(GL_TEXTURE_2D, texture);