Android GL10 Draw drawScreenSpaceQuad(GL10 gl)

Here you can find the source of drawScreenSpaceQuad(GL10 gl)

Description

draw Screen Space Quad

License

Apache License

Declaration

public static void drawScreenSpaceQuad(GL10 gl) 

Method Source Code

//package com.java2s;
/*//from w ww. j a  va 2s  . c o m
 * Copyright 2010-2011 bodo, eyebex, ralph, spotter
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

import android.opengl.GLU;
import java.nio.ByteBuffer;
import javax.microedition.khronos.opengles.GL10;

public class Main {
    private static final byte WIDTH = 1, HEIGHT = 1;
    private static final ByteBuffer VERTICES = ByteBuffer.allocateDirect(8)
            .put((byte) 0).put((byte) 0).put((byte) 0).put(HEIGHT)
            .put(WIDTH).put(HEIGHT).put(WIDTH).put((byte) 0);

    public static void drawScreenSpaceQuad(GL10 gl) {
        gl.glMatrixMode(GL10.GL_PROJECTION);
        gl.glPushMatrix();
        gl.glLoadIdentity();
        GLU.gluOrtho2D(gl, 0, WIDTH, HEIGHT, 0);

        gl.glVertexPointer(2, GL10.GL_BYTE, 0, VERTICES);
        gl.glDrawArrays(GL10.GL_TRIANGLE_FAN, 0, 4);

        gl.glPopMatrix();
    }
}

Related

  1. drawSquare(GL10 gl, float r, float g, float b, float a)
  2. drawSquare(GL10 gl, float x, float y, float r, float g, float b, float a)