I have looked at a lot of code for the implementing a GLSurfaceView in a LiveWallpaper and none of the code I have looked at has worked so far. I was wondering if anyone could help me with this problem, here is my code for the GLSurfaceVIew Renderer below (Also I am using OpenGLES 1 or GL10):
public class ExampleRenderer implements GLSurfaceView.Renderer {
Triangle triangle;
Square square;
@Override
public void onSurfaceCreated(GL10 gl, EGLConfig config) {
gl.glClearColor(0, 0, 0, 1f);
gl.glDisable(GL10.GL_DITHER);
gl.glHint(GL10.GL_PERSPECTIVE_CORRECTION_HINT, GL10.GL_FASTEST);
triangle = new Triangle();
square = new Square();
}
@Override
public void onSurfaceChanged(GL10 gl, int width, int height) {
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, 25);
}
@Override
public void onDrawFrame(GL10 gl) {
gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
gl.glDisable(GL10.GL_DITHER);
gl.glMatrixMode(GL10.GL_MODELVIEW);
gl.glLoadIdentity();
GLU.gluLookAt(gl, 0, 0, 3, 0, 0, 0, 0, 2, 0);
square.draw(gl);
triangle.draw(gl);
}
}