Android Open Source - model-explorer My G L E S20 Debug All






From Project

Back to project page model-explorer.

License

The source code is released under:

Apache License

If you think the Android project model-explorer listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.etaoin.myopengltest.util.gl;
//w  w w  .  j ava2  s . com
import android.opengl.GLES20;

import java.nio.Buffer;
import java.nio.FloatBuffer;

/**
 * Wrapper for all the OpenGL ES 2.0 calls for debugging purposes.
 */
public class MyGLES20DebugAll extends MyGenericGLES20 {

  @Override
  public void glAttachShader(int program, int shader) {
    GLES20.glAttachShader(program, shader);
    checkGlError("glAttachShader");
  }

  @Override
  public void glClear(int mask) {
    GLES20.glClear(mask);
    checkGlError("glClear");
  }

  @Override
  public void glClearColor(float red, float green, float blue, float alpha) {
    GLES20.glClearColor(red, green, blue, alpha);
    checkGlError("glClearColor");
  }

  @Override
  public void glCompileShader(int shader) {
    GLES20.glCompileShader(shader);
    checkGlError("glCompileShader");
  }

  @Override
  public int glCreateProgram() {
    int program = GLES20.glCreateProgram();
    checkGlError("glCreateProgram");
    return program;
  }

  @Override
  public int glCreateShader(int type) {
    int shader = GLES20.glCreateShader(type);
    checkGlError("glCreateShader");
    return shader;
  }

  @Override
  public void glDrawElements(int mode, int count, int type, Buffer indices) {
    GLES20.glDrawElements(mode, count, type, indices);
    checkGlError("glDrawElements");
  }

  @Override
  public void glDrawElements(int mode, int count, int type, int offset) {
    GLES20.glDrawElements(mode, count, type, offset);
    checkGlError("glDrawElements");
  }

  @Override
  public void glEnableVertexAttribArray(int index) {
    GLES20.glEnableVertexAttribArray(index);
    checkGlError("glEnableVertexAttribArray");
  }

  @Override
  public int glGetAttribLocation(int program, String name) {
    int location = GLES20.glGetAttribLocation(program, name);
    checkGlError("glGetAttribLocation");
    return location;
  }

  @Override
  public int glGetUniformLocation(int program, String name) {
    int location = GLES20.glGetUniformLocation(program, name);
    checkGlError("glGetUniformLocation");
    return location;
  }

  @Override
  public void glLinkProgram(int program) {
    GLES20.glLinkProgram(program);
    checkGlError("glLinkProgram");
  }

  @Override
  public void glShaderSource(int shader, String source) {
    GLES20.glShaderSource(shader, source);
    checkGlError("glShaderSource");
  }

  @Override
  public void glUniform3fv(int location, int count, FloatBuffer v) {
     GLES20.glUniform3fv(location, count, v);
    checkGlError("glUniform3fv");
  }

  @Override
  public void glUniform3fv(int location, int count, float[] value, int offset) {
    GLES20.glUniform3fv(location, count, value, offset);
    checkGlError("glUniform3fv");
  }

  @Override
  public void glUniform4fv(int location, int count, FloatBuffer v) {
     GLES20.glUniform4fv(location, count, v);
    checkGlError("glUniform4fv");
  }

  @Override
  public void glUniform4fv(int location, int count, float[] value, int offset) {
    GLES20.glUniform4fv(location, count, value, offset);
    checkGlError("glUniform4fv");
  }

  @Override
  public void glUniformMatrix4fv(int location, int count, boolean transpose, FloatBuffer value) {
    GLES20.glUniformMatrix4fv(location, count, transpose, value);
    checkGlError("glUniformMatrix4fv");
  }

  @Override
  public void glUniformMatrix4fv(int location, int count, boolean transpose, float[] value, int offset) {
    GLES20.glUniformMatrix4fv(location, count, transpose, value, offset);
    checkGlError("glUniformMatrix4fv");
  }

  @Override
  public void glUseProgram(int program) {
    GLES20.glUseProgram(program);
    checkGlError("glUseProgram");
  }

  @Override
  public void glVertexAttribPointer(int index, int size, int type, boolean normalized, int stride, Buffer ptr) {
    GLES20.glVertexAttribPointer(index, size, type, normalized, stride, ptr);
    checkGlError("glVertexAttribPointer");
  }

  @Override
  public void glVertexAttribPointer(int index, int size, int type, boolean normalized, int stride, int offset) {
    GLES20.glVertexAttribPointer(index, size, type, normalized, stride, offset);
    checkGlError("glVertexAttribPointer");
  }

  @Override
  public void glViewport(int x, int y, int width, int height) {
    GLES20.glViewport(x, y, width, height);
    checkGlError("glViewport");
  }

  private void checkGlError(String glOperation) {
    int error;
    if ((error = GLES20.glGetError()) != GLES20.GL_NO_ERROR) {
      throw new RuntimeException(glOperation + ": glError " + error);
    }
  }
}




Java Source Code List

com.etaoin.myopengltest.core.main.activity.MainGLActivity.java
com.etaoin.myopengltest.core.main.context.ContextManager.java
com.etaoin.myopengltest.core.main.context.Context.java
com.etaoin.myopengltest.core.main.context.GameContext.java
com.etaoin.myopengltest.core.main.events.UserEvent.java
com.etaoin.myopengltest.core.main.renderers.MainGLRenderer.java
com.etaoin.myopengltest.core.main.views.MainGLSurfaceView.java
com.etaoin.myopengltest.util.camera.Camera.java
com.etaoin.myopengltest.util.geometry.Face.java
com.etaoin.myopengltest.util.geometry.TriangleList.java
com.etaoin.myopengltest.util.geometry.Vector3List.java
com.etaoin.myopengltest.util.geometry.Vector3.java
com.etaoin.myopengltest.util.gl.MyGLES20DebugAll.java
com.etaoin.myopengltest.util.gl.MyGLES20DebugNone.java
com.etaoin.myopengltest.util.gl.MyGLES20Factory.java
com.etaoin.myopengltest.util.gl.MyGLES20.java
com.etaoin.myopengltest.util.gl.MyGenericGLES20.java
com.etaoin.myopengltest.util.io.FileReader.java
com.etaoin.myopengltest.util.io.ModelParserFactory.java
com.etaoin.myopengltest.util.io.ModelParser.java
com.etaoin.myopengltest.util.io.obj.ObjParser.java
com.etaoin.myopengltest.util.light.PointLight.java
com.etaoin.myopengltest.util.shaders.SampleFragmentShader.java
com.etaoin.myopengltest.util.shaders.SampleVertexShader.java
com.etaoin.myopengltest.util.shaders.ShaderFactory.java
com.etaoin.myopengltest.util.shaders.Shader.java
com.etaoin.myopengltest.util.shapes.Axis.java
com.etaoin.myopengltest.util.shapes.Background.java
com.etaoin.myopengltest.util.shapes.Drawable.java
com.etaoin.myopengltest.util.shapes.Model.java