*Correction*
GLfloat vertex[4]={1,2,-5,1};
//function to do multiplication
#include <gl/gl.h>
void MultiplyVMatrix(GLfloat* Vertex, GLfloat* Matrix, GLfloat* ResultMatrix)
{
for(int i=0;i<16;i++)
ResultMatrix[i/4]+=Matrix[i]*Vertex[i%4];
}
**************************************************************
//modelview matrix and multiply co-ordinate of cube
GLfloat matrix[16];
GLfloat vertex[4]={1,2,-5,1}; //any co-ordinate for testing
GLfloat resultmatrix[4]={0,0,0,0};
glGetFloatv(GL_MODELVIEW_MATRIX, matrix); //grab the modelview matrix
MultiplyVMatrix(vertex,matrix,resultmatrix);
If you are experiencing a similar issue, please ask a related question
Join the community of 500,000 technology professionals and ask your questions.
Connect with top rated Experts
19 Experts available now in Live!