Package fcagnin.jglsdk.glutil

Examples of fcagnin.jglsdk.glutil.MatrixStack.top()


                modelMatrix.push();

                glUseProgram( whiteDiffuseColor.theProgram );
                glUniformMatrix4( whiteDiffuseColor.modelToCameraMatrixUnif, false,
                        modelMatrix.top().fillAndFlipBuffer( mat4Buffer ) );
                Mat3 normMatrix = new Mat3( modelMatrix.top() );
                glUniformMatrix3( whiteDiffuseColor.normalModelToCameraMatrixUnif, false,
                        normMatrix.fillAndFlipBuffer( mat3Buffer ) );
                planeMesh.render();
                glUseProgram( 0 );
View Full Code Here


                modelMatrix.applyMatrix( objtPole.calcMatrix() );

                if ( drawColoredCyl ) {
                    glUseProgram( vertexDiffuseColor.theProgram );
                    glUniformMatrix4( vertexDiffuseColor.modelToCameraMatrixUnif, false,
                            modelMatrix.top().fillAndFlipBuffer( mat4Buffer ) );
                    Mat3 normMatrix = new Mat3( modelMatrix.top() );
                    glUniformMatrix3( vertexDiffuseColor.normalModelToCameraMatrixUnif, false,
                            normMatrix.fillAndFlipBuffer( mat3Buffer ) );
                    cylinderMesh.render( "lit-color" );
                } else {
View Full Code Here

                if ( drawColoredCyl ) {
                    glUseProgram( vertexDiffuseColor.theProgram );
                    glUniformMatrix4( vertexDiffuseColor.modelToCameraMatrixUnif, false,
                            modelMatrix.top().fillAndFlipBuffer( mat4Buffer ) );
                    Mat3 normMatrix = new Mat3( modelMatrix.top() );
                    glUniformMatrix3( vertexDiffuseColor.normalModelToCameraMatrixUnif, false,
                            normMatrix.fillAndFlipBuffer( mat3Buffer ) );
                    cylinderMesh.render( "lit-color" );
                } else {
                    glUseProgram( whiteDiffuseColor.theProgram );
View Full Code Here

                            normMatrix.fillAndFlipBuffer( mat3Buffer ) );
                    cylinderMesh.render( "lit-color" );
                } else {
                    glUseProgram( whiteDiffuseColor.theProgram );
                    glUniformMatrix4( whiteDiffuseColor.modelToCameraMatrixUnif, false,
                            modelMatrix.top().fillAndFlipBuffer( mat4Buffer ) );
                    Mat3 normMatrix = new Mat3( modelMatrix.top() );
                    glUniformMatrix3( whiteDiffuseColor.normalModelToCameraMatrixUnif, false,
                            normMatrix.fillAndFlipBuffer( mat3Buffer ) );
                    cylinderMesh.render( "lit" );
                }
View Full Code Here

                    cylinderMesh.render( "lit-color" );
                } else {
                    glUseProgram( whiteDiffuseColor.theProgram );
                    glUniformMatrix4( whiteDiffuseColor.modelToCameraMatrixUnif, false,
                            modelMatrix.top().fillAndFlipBuffer( mat4Buffer ) );
                    Mat3 normMatrix = new Mat3( modelMatrix.top() );
                    glUniformMatrix3( whiteDiffuseColor.normalModelToCameraMatrixUnif, false,
                            normMatrix.fillAndFlipBuffer( mat3Buffer ) );
                    cylinderMesh.render( "lit" );
                }
                glUseProgram( 0 );
View Full Code Here

                modelMatrix.translate( worldLightPos.x, worldLightPos.y, worldLightPos.z );
                modelMatrix.scale( 0.1f, 0.1f, 0.1f );

                glUseProgram( unlit.theProgram );
                glUniformMatrix4( unlit.modelToCameraMatrixUnif, false,
                        modelMatrix.top().fillAndFlipBuffer( mat4Buffer ) );
                glUniform4f( unlit.objectColorUnif, 0.8078f, 0.8706f, 0.9922f, 1.0f );
                cubeMesh.render( "flat" );

                modelMatrix.pop();
            }
View Full Code Here

    protected void reshape(int w, int h) {
        MatrixStack persMatrix = new MatrixStack();
        persMatrix.perspective( 45.0f, (w / (float) h), zNear, zFar );

        ProjectionBlock projData = new ProjectionBlock();
        projData.cameraToClipMatrix = persMatrix.top();

        glBindBuffer( GL_UNIFORM_BUFFER, projectionUniformBuffer );
        glBufferSubData( GL_UNIFORM_BUFFER, 0, projData.fillAndFlipBuffer( mat4Buffer ) );
        glBindBuffer( GL_UNIFORM_BUFFER, 0 );
View Full Code Here

            MatrixStack camMatrix = new MatrixStack();
            camMatrix.setMatrix( calcLookAtMatrix( camPos, camTarget, new Vec3( 0.0f, 1.0f, 0.0f ) ) );

            glUseProgram( uniformColor.theProgram );
            glUniformMatrix4( uniformColor.worldToCameraMatrixUnif, false,
                    camMatrix.top().fillAndFlipBuffer( mat4Buffer ) );
            glUseProgram( objectColor.theProgram );
            glUniformMatrix4( objectColor.worldToCameraMatrixUnif, false,
                    camMatrix.top().fillAndFlipBuffer( mat4Buffer ) );
            glUseProgram( uniformColorTint.theProgram );
            glUniformMatrix4( uniformColorTint.worldToCameraMatrixUnif, false,
View Full Code Here

            glUseProgram( uniformColor.theProgram );
            glUniformMatrix4( uniformColor.worldToCameraMatrixUnif, false,
                    camMatrix.top().fillAndFlipBuffer( mat4Buffer ) );
            glUseProgram( objectColor.theProgram );
            glUniformMatrix4( objectColor.worldToCameraMatrixUnif, false,
                    camMatrix.top().fillAndFlipBuffer( mat4Buffer ) );
            glUseProgram( uniformColorTint.theProgram );
            glUniformMatrix4( uniformColorTint.worldToCameraMatrixUnif, false,
                    camMatrix.top().fillAndFlipBuffer( mat4Buffer ) );
            glUseProgram( 0 );
View Full Code Here

            glUseProgram( objectColor.theProgram );
            glUniformMatrix4( objectColor.worldToCameraMatrixUnif, false,
                    camMatrix.top().fillAndFlipBuffer( mat4Buffer ) );
            glUseProgram( uniformColorTint.theProgram );
            glUniformMatrix4( uniformColorTint.worldToCameraMatrixUnif, false,
                    camMatrix.top().fillAndFlipBuffer( mat4Buffer ) );
            glUseProgram( 0 );

            MatrixStack modelMatrix = new MatrixStack();

            // Render the ground plane.
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.