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

https://www.opengl.org/resources/libraries/glut/glut_downloads.php

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?

Answers


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);

in[0]=winx;
in[1]=winy;
in[2]=winz;
in[3]=1.0;

/* 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];
return(GL_TRUE);
}

Post Status

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

Search




Leave an answer


Quote of the day: live life