//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 cube
GLfloat matrix[16];
GLfloat vertex[4]={1,2,-5,0}; //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);
translation.gif
If you are experiencing a similar issue, please ask a related question
Title | # Comments | Views | Activity |
---|---|---|---|
Flash video stream duplicate | 5 | 347 | |
Python - creating byte arrays help | 3 | 386 | |
Game needs - How much would Reese Witherspoon or Buffy charge per hour? | 4 | 158 | |
Any Fantasy Football Brute force AI suggestions? | 2 | 59 |
Join the community of 500,000 technology professionals and ask your questions.