GL10 glMatrixMode - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for GL10 glMatrixMode method.

This code example shows how to use the following methods:glFrustumf, glLoadIdentity, glMatrixMode, glViewport
 
        mAngle += 1.2f;
    } 
 
    public void onSurfaceChanged(GL10 gl, int width, int height) {
         gl.glViewport(0, 0, width, height);
 
         /* 
          * Set our projection matrix. This doesn't have to be done 
          * each time we draw, but usually a new projection needs to 
          * be set when the viewport is resized. 
          */ 
 
         float ratio = (float) width / height;
         gl.glMatrixMode(GL10.GL_PROJECTION);
         gl.glLoadIdentity();
         gl.glFrustumf(-ratio, ratio, -1, 1, 1, 10);
    } 
 
    public void onSurfaceCreated(GL10 gl, EGLConfig config) {

7
CodeRank
This code example shows how to use the following methods:glDepthFunc, glDisable, glLoadIdentity, glMatrixMode
        glManager.resetCamera();
        glManager.resetWorldMatrix();
        GL11 gl = glManager.getGL();
 
        //! ライト無効化 
        gl.glDisable(GL10.GL_LIGHTING);
 
        //! 深度テストの無効化と、評価式の変更 
        gl.glDisable(GL10.GL_DEPTH_TEST);
        gl.glDepthFunc(GL10.GL_ALWAYS);
 
        //! 描画用四角形の関連付け 
        quadPolygon.bind();
 
        //! ポリゴン色の設定 
        setColor(0xffffffff); 
        glManager.getGL().glColor4f(1, 1, 1, 1);
 
        //! テクスチャ行列のリセット 
        { 

6
CodeRank
This code example shows how to use the following methods:gluPerspective, glLoadIdentity, glMatrixMode, glViewport
	public void onSurfaceChanged(GL10 gl, int width, int height) {
		if (height == 0) { // Prevent A Divide By Zero By
			height = 1; // Making Height Equal One
		} 
 
		gl.glViewport(0, 0, width, height); // Reset The Current Viewport
		gl.glMatrixMode(GL10.GL_PROJECTION); // Select The Projection Matrix
		gl.glLoadIdentity(); // Reset The Projection Matrix
 
		// Calculate The Aspect Ratio Of The Window 
		GLU.gluPerspective(gl, 45.0f, (float) width / (float) height, 0.1f,
				100.0f); 
 
		gl.glMatrixMode(GL10.GL_MODELVIEW); // Select The Modelview Matrix
		gl.glLoadIdentity(); // Reset The Modelview Matrix
	} 
 
	/** 
	 * Override the touch screen listener. 
	 *  
8
CodeRank
This code example shows how to use the following methods:glFrustumf, glLoadIdentity, glMatrixMode, glViewport
 
        mAngle += 1.2f;
    } 
 
    public void onSurfaceChanged(GL10 gl, int width, int height) {
         gl.glViewport(0, 0, width, height);
 
         /* 
          * Set our projection matrix. This doesn't have to be done 
          * each time we draw, but usually a new projection needs to 
          * be set when the viewport is resized. 
          */ 
 
         float ratio = (float) width / height;
         gl.glMatrixMode(GL10.GL_PROJECTION);
         gl.glLoadIdentity();
         gl.glFrustumf(-ratio, ratio, -1, 1, 1, 10);
    } 
 
    public void onSurfaceCreated(GL10 gl, EGLConfig config) {

6
CodeRank
This code example shows how to use the following methods:gluOrtho2D, glLoadIdentity, glMatrixMode, glViewport
    public void onSurfaceChanged(GL10 gl1, int width, int height) {
        Log.v(TAG, "onSurfaceChanged: " + width + "x" + height
                + ", gl10: " + gl1.toString());
        GL11 gl = (GL11) gl1;
        mGL = gl;
        gl.glViewport(0, 0, width, height);
 
        gl.glMatrixMode(GL11.GL_PROJECTION);
        gl.glLoadIdentity();
 
        GLU.gluOrtho2D(gl, 0, width, 0, height);
        Matrix matrix = mTransformation.getMatrix();
        matrix.reset();
        matrix.preTranslate(0, getHeight());
        matrix.preScale(1, -1);
    } 
 
    private void setAlphaValue(float alpha) {
        if (mLastAlpha == alpha) return;
 
6
CodeRank
This code example shows how to use the following methods:glFrustumf, glLoadIdentity, glMatrixMode, glViewport
    } 
 
    public void onSurfaceChanged(GL10 gl, int w, int h) {
        mWidth = w;
        mHeight = h;
        gl.glViewport(0, 0, w, h);
        mProjector.setCurrentView(0, 0, w, h);
 
        /* 
        * Set our projection matrix. This doesn't have to be done 
        * each time we draw, but usually a new projection needs to 
        * be set when the viewport is resized. 
        */ 
 
        float ratio = (float) w / h;
        gl.glMatrixMode(GL10.GL_PROJECTION);
        gl.glLoadIdentity();
        gl.glFrustumf(-ratio, ratio, -1, 1, 1, 10);
        mProjector.getCurrentProjection(gl);
    } 

8
CodeRank
This code example shows how to use the following methods:glFrustumf, glLoadIdentity, glMatrixMode, glViewport
    /** 
     * Handle change of size. 
     */ 
    @Override 
    public void sizeChanged(GL10 gl, int w, int h) {
        gl.glViewport(0, 0, w, h);
        gl.glMatrixMode(GL10.GL_PROJECTION);
        gl.glLoadIdentity();
        float ratio = (float) w / h;
        gl.glFrustumf(-ratio, ratio, -1, 1, 3, 7);
    } 
 
    /** 
     * Create some big objects that we want 
     * around only when we're drawing. 
     */ 
    @Override 
    public void surfaceCreated(GL10 gl) {
        // set up the surface 
        gl.glDisable(GL10.GL_DITHER);
8
CodeRank
This code example shows how to use the following methods:glFrustumf, glLoadIdentity, glMatrixMode, glViewport
            mAngle += 1.2f;
        } 
 
        public void onSurfaceChanged(GL10 gl, int width, int height) {
            checkGLError(gl);
            gl.glViewport(0, 0, width, height);
            float ratio = (float) width / height;
            gl.glMatrixMode(GL10.GL_PROJECTION);
            gl.glLoadIdentity();
            gl.glFrustumf(-ratio, ratio, -1, 1, 1, 10);
            checkGLError(gl);
        } 
 
        public void onSurfaceCreated(GL10 gl, EGLConfig config) {
            checkGLError(gl);
            // This test needs to be done each time a context is created, 
            // because different contexts may support different extensions. 
            mContextSupportsCubeMap = checkIfContextSupportsCubeMap(gl);
 
            mGrid = generateTorusGrid(gl, 60, 60, 3.0f, 0.75f);
6
CodeRank
This code example shows how to use the following methods:gluPerspective, glLoadIdentity, glMatrixMode, glViewport
	public void onSurfaceChanged(GL10 gl, int width, int height) {
		if (height == 0) { // Prevent A Divide By Zero By
			height = 1; // Making Height Equal One
		} 
 
		gl.glViewport(0, 0, width, height); // Reset The Current Viewport
		gl.glMatrixMode(GL10.GL_PROJECTION); // Select The Projection Matrix
		gl.glLoadIdentity(); // Reset The Projection Matrix
 
		// Calculate The Aspect Ratio Of The Window 
		GLU.gluPerspective(gl, 45.0f, (float) width / (float) height, 0.1f, 100.0f);
 
		gl.glMatrixMode(GL10.GL_MODELVIEW); // Select The Modelview Matrix
		gl.glLoadIdentity(); // Reset The Modelview Matrix
	} 
 
	/** 
	 * Override the touch screen listener. 
	 *  
	 * React to moves and presses on the touchscreen. 
8
CodeRank
This code example shows how to use the following methods:glDisable, glMatrixMode, glPopMatrix
     * 
     * @param gl 
     */ 
    public void endDrawing(GL10 gl) {
        checkState(STATE_DRAWING, STATE_INITIALIZED);
        gl.glDisable(GL10.GL_BLEND);
        gl.glMatrixMode(GL10.GL_PROJECTION);
        gl.glPopMatrix();
        gl.glMatrixMode(GL10.GL_MODELVIEW);
        gl.glPopMatrix();
    } 
 
    private void checkState(int oldState, int newState) {
        if (mState != oldState) {
            throw new IllegalArgumentException("Can't call this method now.");
        } 
        mState = newState;
    } 
 
    private static class Label { 
7
CodeRank

Related GL10 glMatrixMode Questions & Answers: