more dos port
[retroray] / src / modern / main.c
index e511b65..1af9e85 100644 (file)
@@ -20,6 +20,7 @@ along with this program.  If not, see <https://www.gnu.org/licenses/>.
 #include <assert.h>
 #include "miniglut.h"
 #include "app.h"
+#include "logger.h"
 
 static void reshape(int x, int y);
 static void keydown(unsigned char key, int x, int y);
@@ -77,7 +78,11 @@ int main(int argc, char **argv)
        wgl_swap_interval_ext = wglGetProcAddress("wglSwapIntervalEXT");
 #endif
 
-       app_reshape(glutGet(GLUT_WINDOW_WIDTH), glutGet(GLUT_WINDOW_HEIGHT));
+       win_width = glutGet(GLUT_WINDOW_WIDTH);
+       win_height = glutGet(GLUT_WINDOW_HEIGHT);
+       win_aspect = (float)win_width / win_height;
+
+       init_logger();
 
        if(app_init() == -1) {
                return 1;
@@ -99,6 +104,23 @@ void app_redisplay(void)
 
 void app_swap_buffers(void)
 {
+       glMatrixMode(GL_PROJECTION);
+       glPushMatrix();
+       glLoadIdentity();
+       glMatrixMode(GL_MODELVIEW);
+       glLoadIdentity();
+
+       glRasterPos2i(-1, 1);
+       glPixelZoom(1, -1);
+       glEnable(GL_ALPHA_TEST);
+       glAlphaFunc(GL_GREATER, 0.5f);
+       glDrawPixels(win_width, win_height, GL_BGRA, GL_UNSIGNED_BYTE, framebuf);
+       glDisable(GL_ALPHA_TEST);
+
+       glMatrixMode(GL_PROJECTION);
+       glPopMatrix();
+       glMatrixMode(GL_MODELVIEW);
+
        glutSwapBuffers();
        assert(glGetError() == GL_NO_ERROR);
 }