add relative mouse handling in mouse.asm
[retroray] / src / gaw / gaw_gl.c
index fbec9a8..1868d26 100644 (file)
@@ -1,5 +1,5 @@
 /*
-Deep Runner - 6dof shooter game for the SGI O2.
+RetroRay - integrated standalone vintage modeller/renderer
 Copyright (C) 2023  John Tsiombikas <nuclear@mutantstargoat.com>
 
 This program is free software: you can redistribute it and/or modify
@@ -18,7 +18,17 @@ along with this program.  If not, see <https://www.gnu.org/licenses/>.
 #include <string.h>
 #include "util.h"
 #include "gaw.h"
-#include "opengl.h"
+
+#if defined(WIN32) || defined(__WIN32)
+#include <windows.h>
+#endif
+#ifdef __APPLE__
+#include <OpenGL/gl.h>
+#include <OpenGL/glu.h>
+#else
+#include <GL/gl.h>
+#include <GL/glu.h>
+#endif
 
 
 static const float *vertex_ptr, *normal_ptr, *texcoord_ptr, *color_ptr;
@@ -34,6 +44,11 @@ void gaw_viewport(int x, int y, int w, int h)
        glViewport(x, y, w, h);
 }
 
+void gaw_get_viewport(int *vp)
+{
+       glGetIntegerv(GL_VIEWPORT, vp);
+}
+
 void gaw_matrix_mode(int mode)
 {
        mode += GL_MODELVIEW;
@@ -157,6 +172,9 @@ void gaw_enable(int st)
        case GAW_TEXTURE_2D:
                glEnable(GL_TEXTURE_2D);
                break;
+       case GAW_POLYGON_OFFSET:
+               glEnable(GL_POLYGON_OFFSET_FILL);
+               break;
        default:
                break;
        }
@@ -204,6 +222,9 @@ void gaw_disable(int st)
        case GAW_TEXTURE_2D:
                glDisable(GL_TEXTURE_2D);
                break;
+       case GAW_POLYGON_OFFSET:
+               glDisable(GL_POLYGON_OFFSET_FILL);
+               break;
        default:
                break;
        }
@@ -225,6 +246,11 @@ void gaw_alpha_func(int func, float ref)
        glAlphaFunc(func + GL_NEVER, ref);
 }
 
+void gaw_zoffset(float offs)
+{
+       glPolygonOffset(1, offs);
+}
+
 void gaw_clear_color(float r, float g, float b, float a)
 {
        glClearColor(r, g, b, a);
@@ -379,6 +405,11 @@ void gaw_vertex3f(float x, float y, float z)
        glVertex3f(x, y, z);
 }
 
+void gaw_vertex4f(float x, float y, float z, float w)
+{
+       glVertex4f(x, y, z, w);
+}
+
 void gaw_rect(float x1, float y1, float x2, float y2)
 {
        glRectf(x1, y1, x2, y2);