Code example for GL10

Methods: glClearglEnableglLightfvglMatrixModeglRotatefglScalefglTranslatefglViewport

0
            mScale = 2.0f/maxSpan;
        } 
 
        int w = getWidth();
        int h = getHeight();
        gl.glViewport(0, 0, w, h);
 
        float ratio = (float)w/h;
        glView.setAspectRatio(ratio);
 
        // Clear buffers 
        gl.glClear(gl.GL_COLOR_BUFFER_BIT | gl.GL_DEPTH_BUFFER_BIT);
 
        // Set up the projection and view 
        glView.setProjection(gl);
        glView.setView(gl);
 
        // Set up lighting 
        gl.glMatrixMode(gl.GL_MODELVIEW);
        gl.glEnable(gl.GL_LIGHTING);
        gl.glEnable(gl.GL_LIGHT0);
        gl.glLightfv(gl.GL_LIGHT0, gl.GL_POSITION, mLightDir, 0);
        glView.setLights(gl, gl.GL_LIGHT0);
 
        // Rotate the viewpoint around the model 
        gl.glRotatef(mTiltAngle, 1, 0, 0);
        gl.glRotatef(mRotAngle, 0, 1, 0);
 
        // Scale object to fit in [-1, 1] 
        gl.glScalef(mScale, mScale, mScale);
 
        // Center the object at the origin 
        gl.glTranslatef(-mCenterX, -mCenterY, -mCenterZ);
 
        // Increment the rotation angle 
        mRotAngle += mRotVelocity;
        if (mRotAngle < 0.0f) {
            mRotAngle += 360.0f;
Contextual code suggestions in your IDE  Get Codota for Java