Android Open Source - android_shaderize Renderer Flat






From Project

Back to project page android_shaderize.

License

The source code is released under:

Apache License

If you think the Android project android_shaderize 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 fi.harism.shaderize;
/*w  w w .  java 2s  .  c o  m*/
import android.content.Context;
import android.content.SharedPreferences;
import android.view.ViewGroup;

public class RendererFlat extends Renderer {

  private Context mContext;
  private final ObjShader mShaderCube = new ObjShader();

  @Override
  public void onDestroy() {
    mContext = null;
    mShaderCube.deleteProgram();
  }

  @Override
  public void onDrawFrame(ObjFbo fbo, ObjScene scene) {
    fbo.bind();
    fbo.bindTexture(0);
    Utils.renderScene(scene, mShaderCube);
  }

  @Override
  public void onSurfaceChanged(int width, int height) throws Exception {
  }

  @Override
  public void onSurfaceCreated() throws Exception {
    String vertexSource, fragmentSource;
    vertexSource = Utils.loadRawResource(mContext, R.raw.flat_cube_vs);
    fragmentSource = Utils.loadRawResource(mContext, R.raw.flat_cube_fs);
    mShaderCube.setProgram(vertexSource, fragmentSource);
  }

  @Override
  public void setContext(Context context) {
    mContext = context;
  }

  @Override
  public void setPreferences(SharedPreferences prefs, ViewGroup parent) {
  }

}




Java Source Code List

fi.harism.shaderize.MainActivity.java
fi.harism.shaderize.MainMenus.java
fi.harism.shaderize.MainRenderer.java
fi.harism.shaderize.Matrix.java
fi.harism.shaderize.ObjCube.java
fi.harism.shaderize.ObjFbo.java
fi.harism.shaderize.ObjScene.java
fi.harism.shaderize.ObjShader.java
fi.harism.shaderize.PrefsSeekBar.java
fi.harism.shaderize.RendererBloom.java
fi.harism.shaderize.RendererDof.java
fi.harism.shaderize.RendererFlat.java
fi.harism.shaderize.RendererFxaa.java
fi.harism.shaderize.RendererHex.java
fi.harism.shaderize.RendererLightning.java
fi.harism.shaderize.RendererRounded.java
fi.harism.shaderize.Renderer.java
fi.harism.shaderize.Utils.java