ecere/gfx/drivers/OpenGL: Fixed VBO/IBOs mixup
[sdk] / ecere / src / gfx / drivers / OpenGLDisplayDriver.ec
index 66897fd..31bb57e 100644 (file)
@@ -1211,6 +1211,18 @@ void (APIENTRY * glBufferDataARB) (GLenum target, int size, const GLvoid *data,
 
 static int currentVertexBuffer;
 
+public void GLLoadMatrix(Matrix matrix)
+{
+   float m[16] =
+   {
+      (float)matrix.m[0][0], (float)matrix.m[0][1], (float)matrix.m[0][2], (float)matrix.m[0][3],
+      (float)matrix.m[1][0], (float)matrix.m[1][1], (float)matrix.m[1][2], (float)matrix.m[1][3],
+      (float)matrix.m[2][0], (float)matrix.m[2][1], (float)matrix.m[2][2], (float)matrix.m[2][3],
+      (float)matrix.m[3][0], (float)matrix.m[3][1], (float)matrix.m[3][2], (float)matrix.m[3][3]
+   };
+   glLoadMatrixf(m);
+}
+
 bool GLSelectVBO(uint vbo)
 {
    if(currentVertexBuffer != vbo)
@@ -1256,7 +1268,8 @@ void GLBindBuffer(int target, uint buffer)
 #endif
       glBindBufferARB(target, buffer);
 #endif
-   currentVertexBuffer = buffer;
+   if(target == GL_ARRAY_BUFFER_ARB)
+      currentVertexBuffer = buffer;
 }
 
 public void GLVertexPointer(int numCoords, int glType, int stride, void *ptr, int numVertices)