Login  Register

Re: Can't get to see my triangle when I use FloatUtil.makeLookAt

Posted by Kraft on Nov 15, 2015; 6:21pm
URL: https://forum.jogamp.org/Can-t-get-to-see-my-triangle-when-I-use-FloatUtil-makeLookAt-tp4035777p4035783.html

Still searching on the internet for clues on how to use FloatUtil.makeLookAt and FloatUtil.makePerspective to produce the mvp matrix that I send to the vertex shader.

According your experience, is this the right way to do ?

        // create model matrix
        FloatUtil.makeScale(scale, true, 1.5f, 1.5f, 1.5f);
        FloatUtil.makeRotationEuler(rotation, 0, 0.0f, 0.0f, (time%1000)/1000.0f);
        FloatUtil.makeTranslation(translation, true, 0.0f, 0.0f, 0.0f);
        FloatUtil.makeIdentity(model);
        FloatUtil.multMatrix(model, scale);
        FloatUtil.multMatrix(model, rotation);
        FloatUtil.multMatrix(model, translation);

        // create mvp matrix
        FloatUtil.makeLookAt(view, 0, cameraRaw, 0, cameraRaw, 3, cameraRaw, 6, temp);
        FloatUtil.makePerspective(projection, 0, true, FloatUtil.HALF_PI, 4.0f/3.0f, 0.1f, 100.0f);
        FloatUtil.makeIdentity(mvp);
        FloatUtil.multMatrix(mvp, model);
        FloatUtil.multMatrix(mvp, view);
        FloatUtil.multMatrix(mvp, projection);
        ...
        gl4.glUseProgram(program);
        gl4.glUniformMatrix4fv(modelToClipMatrixUL, 1, false, mvp, 0);