Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
private GLSquare square;
private GLCube cube;
private GLLines lines;
private GLTriangle3D tri;
@Override
public void onDrawFrame(GL10 gl) {
gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
gl.glMatrixMode(GL10.GL_MODELVIEW);
gl.glLoadIdentity();
GLU.gluLookAt(gl, 0f, 0f, -10f, 0f, 0f, 0f, 0f, 2f, 0f);
gl.glTranslatef(6f, 9f, 0f);
square.draw(gl, 1, 0, 0, 1);
long time = SystemClock.uptimeMillis() % 4000L;
float angle = 0.090f * ((int) time);
gl.glTranslatef(-6f, -9f, 0f);
gl.glRotatef(angle, 1, 0, 0);
lines.draw(gl, 0f, 0f, 0f, 1f);
cube.draw(gl, 1, 0.5f, 0.25f, 0.5f);
tri.draw(gl, .25f, .5f, .75f, 1);
}
@Override
public void onSurfaceChanged(GL10 gl, int i, int j) {
gl.glViewport(0, 0, i, j);
float ratio = (float) i / j;
gl.glMatrixMode(GL10.GL_PROJECTION);
gl.glLoadIdentity();
gl.glFrustumf(-ratio, ratio, -1, 1, 1, 25);
gl.glClearColor(1f, 1f, 1f, 1);
}
@Override
public void onSurfaceCreated(GL10 gl, EGLConfig eglConfig) {
gl.glDisable(GL10.GL_DITHER);
gl.glDisable(GL10.GL_DEPTH_TEST);
gl.glHint(GL10.GL_PERSPECTIVE_CORRECTION_HINT, GL10.GL_FASTEST);
gl.glClearDepthf(1f);
}
public GLGameRenderer() {
square = new GLSquare();
cube = new GLCube();
lines = new GLLines();
tri = new GLTriangle3D();
}