Basically I have written a class to draw a cube centered on a point (XYZ). I perform various tranlations on my scene using glTranslate/glRotate. Now I want to calculate the new position of the cube ("world co-ordinates" if that is the right term.)

It has been suggested that I should multiple the Point by the Modelviewmatrix I have achieved this by doing the following (see code).

Is this code correct and will it do what I want it to?

//function to do multiplication#include <gl/gl.h>void MultiplyVMatrix(GLfloat* Vertex, GLfloat* Matrix, GLfloat* ResultMatrix){ for(int i=0;i<16;i++) for(int j=0;j<4;j++) ResultMatrix[j]+=Matrix[i]*Vertex[j];} **************************************************************//modelview matrix and multiply co-ordinate of cubeGLfloat matrix[16];GLfloat vertex[4]={1,2,-5,0}; //any co-ordinate for testingGLfloat resultmatrix[4]={0,0,0,0};glGetFloatv(GL_MODELVIEW_MATRIX, matrix); //grab the modelview matrixMultiplyVMatrix(vertex,matrix,resultmatrix);

one is divide, one is moduo
I presumed that
ResultMatrix = Matrix *Vertex
and that Matrix was laid out as
m0 m4 m8 m12
m1 m5 m9 m13
m2 m6 m10 m14
m3 m7 m11 m15

the original code was equivalent to multiplying each element by
(m0+m1+m2+m3+m4+m5+...+m15)

As game developers, we quickly learn that Artificial Intelligence (AI) doesnâ€™t need to be so tough. To reference Space Ghost: â€œMoltar, I have a giant brain that is able to reduce any complex machine into a simple yes or no answer. (http://www.youtuâ€¦

Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.