View Full Version : gluUnproject - the matrixes???
grodslukaren
07-03-2001, 05:47 AM
Hi,
When I use gluUnproject I have to use three matrixes, ModelMatrix, ProjMatrix and viewport. Theese matrixes are the matrixes I change with glTranslate() and glRotate()????
Am I right?? and in that case, how can I use them as variables in gluUnproject()?? Anybody have an example on gluUnproject??
/grodslukaren
grodslukaren
07-03-2001, 08:08 AM
I think I have it now. But it still makes me get errors. And I end up in the assembler when I´d like to see my errors...
What´s wrong with this code?? I get errors just by "asking" for modelviewmatrix with glGetDoublev(GL_MODELVIEW_MATRIX, modelviewMatrix);
/////////////
GLdouble* modelviewMatrix = 0;
GLdouble* projectionMatrix = 0;
GLint* viewport = 0;
GLdouble winx,winy,winz;
GLdouble objx, objy, objz;
glMatrixMode(GL_MODELVIEW);
glGetDoublev(GL_MODELVIEW_MATRIX, modelviewMatrix); // first error
glMatrixMode(GL_PROJECTION);
glGetDoublev(GL_PROJECTION_MATRIX,projectionMatrix );
glGetIntegerv(GL_VIEWPORT,viewport);
gluUnProject(winx,winy,winz,modelviewMatrix,projec tionMatrix,viewport,&objx,&objy,&objz);
//////////////
/grodslukaren
DFrey
07-03-2001, 08:25 AM
You have to provide the memory for the matrix to be copied to. For example, change GLdouble* modelviewMatrix = 0; to GLdouble modelviewMatrix[16]; and similarly for the other matrix, and viewport.
grodslukaren
07-03-2001, 08:35 AM
Thanks!!!
That really made it work!!
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.