Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


Reply
Developer
Posts: 59
Registered: ‎05-06-2012
My Device: Blackberry torch 9850
My Carrier: Voila
Accepted Solution

OpenGL Helper Library (GLU)

[ Edited ]

Hello,

It's there no GLU library in the blackberry ndk ?

If so,  can anyone can provide me the definition of the gluLookAt function contain in this library, please.

 

Already, thank you for your supply.

monmomo04.

 

 

 

 

" public static void gluLookAt( float eyeX, float eyeY, float eyeZ, float centerX, float centerY, float centerZ, float upX, float upY, float upZ)"

Developer
Posts: 1,524
Registered: ‎12-18-2012
My Device: Z30, Z10 LE, DevAlpha C, PlayBook

Re: OpenGL Helper Library (GLU)

gluLookAt:

http://www.opengl.org/wiki/GluLookAt_code

 

As for the GLU library I think you'll have to build it. This thread has a link to the source code:

http://supportforums.blackberry.com/t5/Native-Development/Porting-openFrameworks-need-help-with-the-...


Andrey Fidrya, @zmeyc on twitter
Developer
Posts: 59
Registered: ‎05-06-2012
My Device: Blackberry torch 9850
My Carrier: Voila

Re: OpenGL Helper Library (GLU)

Thank for your reply Zmey.. I will suffering those links and give you feedback later.
Developer
Posts: 59
Registered: ‎05-06-2012
My Device: Blackberry torch 9850
My Carrier: Voila

Re: OpenGL Helper Library (GLU)

[ Edited ]

Sorry for the late reply.

In all, i wasn't able to import the glues library that laurence talked about in his post( link to it : http://code.google.com/p/glues/ ) but fortunately the definiton of the function work like a charm.

 Again, thank for your reply.

 

it is :

gluLookAt(GLfloat eyex, GLfloat eyey, GLfloat eyez,
          GLfloat centerx, GLfloat centery, GLfloat centerz,
          GLfloat upx, GLfloat upy, GLfloat upz){
    GLfloat m[16];
        GLfloat x[3], y[3], z[3];
        GLfloat mag;

        /* Make rotation matrix */

        /* Z vector */
        z[0] = eyex - centerx;
        z[1] = eyey - centery;
        z[2] = eyez - centerz;
        mag = sqrt(z[0] * z[0] + z[1] * z[1] + z[2] * z[2]);
        if (mag) {          /* mpichler, 19950515 */
            z[0] /= mag;
            z[1] /= mag;
            z[2] /= mag;
        }

        /* Y vector */
        y[0] = upx;
        y[1] = upy;
        y[2] = upz;

        /* X vector = Y cross Z */
        x[0] = y[1] * z[2] - y[2] * z[1];
        x[1] = -y[0] * z[2] + y[2] * z[0];
        x[2] = y[0] * z[1] - y[1] * z[0];

        /* Recompute Y = Z cross X */
        y[0] = z[1] * x[2] - z[2] * x[1];
        y[1] = -z[0] * x[2] + z[2] * x[0];
        y[2] = z[0] * x[1] - z[1] * x[0];

        /* mpichler, 19950515 */
        /* cross product gives area of parallelogram, which is < 1.0 for
         * non-perpendicular unit-length vectors; so normalize x, y here
         */

        mag = sqrt(x[0] * x[0] + x[1] * x[1] + x[2] * x[2]);
        if (mag) {
            x[0] /= mag;
            x[1] /= mag;
            x[2] /= mag;
        }

        mag = sqrt(y[0] * y[0] + y[1] * y[1] + y[2] * y[2]);
        if (mag) {
            y[0] /= mag;
            y[1] /= mag;
            y[2] /= mag;
        }

    #define M(row,col)  m[col*4+row]
        M(0, 0) = x[0];
        M(0, 1) = x[1];
        M(0, 2) = x[2];
        M(0, 3) = 0.0;
        M(1, 0) = y[0];
        M(1, 1) = y[1];
        M(1, 2) = y[2];
        M(1, 3) = 0.0;
        M(2, 0) = z[0];
        M(2, 1) = z[1];
        M(2, 2) = z[2];
        M(2, 3) = 0.0;
        M(3, 0) = 0.0;
        M(3, 1) = 0.0;
        M(3, 2) = 0.0;
        M(3, 3) = 1.0;
    #undef M
        glMultMatrixf(m);

        /* Translate Eye to Origin */
        glTranslatef(-eyex, -eyey, -eyez);
}