Home Ask Login Register

Developers Planet

Your answer is one click away!

cool mr croc February 2016

using gluUnproject in ios targeting arm64

When I was targeting arm7 gluUnproject was linking fine, now I have had to switch to arm64, the ios compiled glu library that comes with openframeworks complains about there being no arm64 symbols and so it gets ignored, leading to a linker error.

I have found the source code to GLUT


I don't see any mention of it intending to compile for ios. Can it be compiled for ios arm64 target? can it be downloaded pre compiled from anywhere?


cool mr croc February 2016

as rhashimito pointed out, i can define the function myself. i found an implementation of glu

gluUnProject(GLdouble winx, GLdouble winy, GLdouble winz,
    const GLdouble modelMatrix[16], 
    const GLdouble projMatrix[16],
            const GLint viewport[4],
        GLdouble *objx, GLdouble *objy, GLdouble *objz)
double finalMatrix[16];
double in[4];
double out[4];

__gluMultMatricesd(modelMatrix, projMatrix, finalMatrix);
if (!__gluInvertMatrixd(finalMatrix, finalMatrix)) return(GL_FALSE);


/* Map x and y from window coordinates */
in[0] = (in[0] - viewport[0]) / viewport[2];
in[1] = (in[1] - viewport[1]) / viewport[3];

/* Map to range -1 to 1 */
in[0] = in[0] * 2 - 1;
in[1] = in[1] * 2 - 1;
in[2] = in[2] * 2 - 1;

__gluMultMatrixVecd(finalMatrix, in, out);
if (out[3] == 0.0) return(GL_FALSE);
out[0] /= out[3];
out[1] /= out[3];
out[2] /= out[3];
*objx = out[0];
*objy = out[1];
*objz = out[2];

Post Status

Asked in February 2016
Viewed 2,767 times
Voted 6
Answered 1 times


Leave an answer

Quote of the day: live life