Android Open Source - Texample2 Program






From Project

Back to project page Texample2.

License

The source code is released under:

CC0 1.0 Universal http://creativecommons.org/publicdomain/zero/1.0/legalcode

If you think the Android project Texample2 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.android.texample2.programs;
// www  .  j  a  v a 2s . co  m
import android.opengl.GLES20;

import com.android.texample2.AttribVariable;
import com.android.texample2.Utilities;


public abstract class Program {
  
  private int programHandle;
  private int vertexShaderHandle;
  private int fragmentShaderHandle;
  private boolean mInitialized;
  
  public Program() {
    mInitialized = false;
  }
  
  public void init() {
    init(null, null, null);
  }
  
  public void init(String vertexShaderCode, String fragmentShaderCode, AttribVariable[] programVariables) {
    vertexShaderHandle = Utilities.loadShader(GLES20.GL_VERTEX_SHADER, vertexShaderCode);
    fragmentShaderHandle = Utilities.loadShader(GLES20.GL_FRAGMENT_SHADER, fragmentShaderCode);
    
    programHandle = Utilities.createProgram(
          vertexShaderHandle, fragmentShaderHandle, programVariables);
    
    mInitialized = true;
  }
  
  public int getHandle() {
    return programHandle;
  }
  
  public void delete() {
    GLES20.glDeleteShader(vertexShaderHandle);
    GLES20.glDeleteShader(fragmentShaderHandle);
    GLES20.glDeleteProgram(programHandle);
    mInitialized = false;
  }
  
  public boolean initialized() {
    return mInitialized;
  }
}




Java Source Code List

com.android.texample2.AttribVariable.java
com.android.texample2.AttribVariable.java
com.android.texample2.GLText.java
com.android.texample2.GLText.java
com.android.texample2.SpriteBatch.java
com.android.texample2.SpriteBatch.java
com.android.texample2.Texample2Renderer.java
com.android.texample2.Texample2Renderer.java
com.android.texample2.Texample2.java
com.android.texample2.Texample2.java
com.android.texample2.TextureHelper.java
com.android.texample2.TextureHelper.java
com.android.texample2.TextureRegion.java
com.android.texample2.TextureRegion.java
com.android.texample2.Triangle.java
com.android.texample2.Triangle.java
com.android.texample2.Utilities.java
com.android.texample2.Utilities.java
com.android.texample2.Vertices.java
com.android.texample2.Vertices.java
com.android.texample2.programs.BatchTextProgram.java
com.android.texample2.programs.BatchTextProgram.java
com.android.texample2.programs.Program.java
com.android.texample2.programs.Program.java