Package net.rim.device.api.math

Examples of net.rim.device.api.math.Matrix4f


     * @see net.rim.device.api.opengles.GLField#initialize(GL)
     */
    public void initialize(final GL renderer) {
        final GL11 gl = (GL11) renderer;

        _transform = new Matrix4f();
        _transform.translate(0, 0, -4.0f);
        _transform.scale(1.5f);

        // Create the cube for "instanced" rendering
        _cube = new Cube(gl);
View Full Code Here


        _texcoords = texcoords;
        _textureString = texture;

        _animations = new Vector();
        _mti = new Matrix4f();
        _normalMatrix = new Matrix3f();
        _transform = new Transform3D();

        // Set the initial position of the sprite
        setInitialPosition(position);
View Full Code Here

                gl.glBufferData(GL20.GL_ELEMENT_ARRAY_BUFFER, INDICES.length,
                        indices, GL20.GL_STATIC_DRAW);
            }

            // Save the old model view matrix
            final Matrix4f m = new Matrix4f(modelview);

            // Apply the local transformation
            m.multiply(_transform.getMatrix());

            // Bind the vertex and index buffers
            gl.glBindBuffer(GL20.GL_ARRAY_BUFFER, _buffers[0]);
            gl.glBindBuffer(GL20.GL_ELEMENT_ARRAY_BUFFER, _buffers[1]);

            // Set the pointers for the vertex buffer data
            gl.glVertexAttribPointer(0, 3, GL20.GL_FLOAT, false, 0,
                    VERTICES_OFFSET);
            gl.glVertexAttribPointer(1, 3, GL20.GL_FLOAT, false, 0,
                    NORMALS_OFFSET);
            gl.glVertexAttribPointer(2, 2, GL20.GL_FLOAT, false, 0,
                    TEXCOORDS_OFFSET);

            // Enable the generic vertex attribute arrays
            gl.glEnableVertexAttribArray(0);
            gl.glEnableVertexAttribArray(1);
            gl.glEnableVertexAttribArray(2);

            // Load the modelview and normal matrices used for rendering
            gl.glUniformMatrix4fv(_mLoc, 1, false, m.getArray(), 0);
            gl.glUniformMatrix3fv(_nLoc, 1, false, getNormalMatrix(m), 0);

            // Set up the mesh's texture for rendering
            gl.glBindTexture(GL20.GL_TEXTURE_2D, _texture);
            gl.glUniform1i(_tLoc, 0);
View Full Code Here

     *
     * @param gl
     *            The OpenGL 2.0 object that will be initialized
     */
    private void initialize(final GL20 gl) {
        _modelview = new Matrix4f();
        _projection = new Matrix4f();

        // Set up the GL20 object
        gl.glClearColor(0.35f, 0.67f, 1.0f, 1.0f);
        gl.glEnable(GL20.GL_CULL_FACE);
        gl.glDisable(GL20.GL_DITHER);
View Full Code Here

     *
     * @param gl
     *            The reference to the OpenGL v2.0 object
     */
    public void render(final GL20 gl, final Matrix4f modelview) {
        final Matrix4f m = new Matrix4f(modelview);
        _character._transform.getTranslation(_t);

        // Determine which horizontal section of the level to render
        if (_t.x > 0.0f) {
            m.translate(-_t.x, 0.0f, 0.0f);
        }

        // Determine which vertical section of the level to render
        if (_t.y > 0.0f && _t.y <= _levelHeight) {
            m.translate(0.0f, -_t.y, 0.0f);
        } else if (_t.y > _levelHeight) {
            m.translate(0.0f, -_levelHeight, 0.0f);
        }

        // Render the level's tiles
        int count = _tiles.size();
        for (int i = 0; i < count; i++) {
View Full Code Here

TOP

Related Classes of net.rim.device.api.math.Matrix4f

Copyright © 2018 www.massapicom. 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.