ecere/gfx/drivesr/OpenGL: WebGL Fixes
authorJerome St-Louis <jerome@ecere.com>
Thu, 10 Mar 2016 16:41:01 +0000 (11:41 -0500)
committerJerome St-Louis <jerome@ecere.com>
Sun, 3 Jul 2016 08:26:05 +0000 (04:26 -0400)
ecere/src/gfx/drivers/gl3/glab.ec
ecere/src/gfx/drivers/gl3/matrixStack.ec

index ef28267..dc913fe 100644 (file)
@@ -28,6 +28,7 @@
 
 import "immediate"
 import "Display"
+import "OpenGLDisplayDriver"
 
 // Kept public for now
 public void GLABDeleteBuffers(int count, GLAB * buffers)
index 27a45c8..355536e 100644 (file)
@@ -111,6 +111,7 @@ public void glmsLoadMatrix(Matrix matrix)
       (float)matrix.m[3][0], (float)matrix.m[3][1], (float)matrix.m[3][2], (float)matrix.m[3][3]
    };
 #ifdef SHADERS
+      memcpy(matrixStack[curStack][matrixIndex[curStack]].array, matrix.array, sizeof(Matrix));
       shader_LoadMatrixf((MatrixMode) (0x1700 + curStack), m);
 #else
       glLoadMatrixf(m);
@@ -141,6 +142,19 @@ public void glmsPopMatrix()
    }
 }
 
+public void glmsLoadMatrixf(float * i)
+{
+   double m[16] =
+   {
+      i[0*4+0], i[0*4+1], i[0*4+2], i[0*4+3],
+      i[1*4+0], i[1*4+1], i[1*4+2], i[1*4+3],
+      i[2*4+0], i[2*4+1], i[2*4+2], i[2*4+3],
+      i[3*4+0], i[3*4+1], i[3*4+2], i[3*4+3]
+   };
+   memcpy(matrixStack[curStack][matrixIndex[curStack]].array, i, 16*sizeof(double));
+   LoadCurMatrix();
+}
+
 public void glmsLoadMatrixd(double * i)
 {
    memcpy(matrixStack[curStack][matrixIndex[curStack]].array, i, sizeof(Matrix));