Sign in to follow this  
philengland

a simple matrix problem

Recommended Posts

Am just doin an exercise and have a problem...the idea is 2 shear a 2d image. when trying 2 set up the matrix and ran into a problem. The full program with everythin else is fine. it still compiles and runs but this viewport does not display as i get 2 warnings saying warning C4047: 'function' : 'const float *' differs in levels of indirection from 'float [4][4]' warning C4024: 'glLoadMatrixf' : different types for formal and actual parameter 1 the code is below... float shearMatrix[4][4]; //decared earlier void display(void) { shearMatrix[0][0] = 1.0; shearMatrix[0][1] = 0.0; shearMatrix[0][2] = 0.0; shearMatrix[0][3] = 0.0; shearMatrix[1][0] = 2.0; shearMatrix[1][1] = 1.0; shearMatrix[1][2] = 0.0; shearMatrix[1][3] = 0.0; shearMatrix[2][0] = 0.0; shearMatrix[2][1] = 0.0; shearMatrix[2][2] = 1.0; shearMatrix[2][3] = 0.0; shearMatrix[3][0] = 0.0; shearMatrix[3][1] = 0.0; shearMatrix[3][2] = 0.0; shearMatrix[3][3] = 1.0; glClear(GL_COLOR_BUFFER_BIT) ; // clear the background glMatrixMode(GL_PROJECTION) ; glPushMatrix(); glViewport(200,0,200,200); glMatrixMode(GL_PROJECTION); glLoadMatrixf(shearMatrix); initials(); //calls polygon co-ordinates for the image glPopMatrix(); glutSwapBuffers() ; } Any guidance or a solution would be excellent. Thanks

Share this post


Link to post
Share on other sites
Although, you can use float shearMatrix[4][4] if you like also, it's much simpler since it makes it more obvious how to access row and column info. Just cast it to float* of GLfloat* as JohnBolton told you.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this