Skip to content

Instantly share code, notes, and snippets.

@selfsame
Created October 13, 2013 19:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save selfsame/6966702 to your computer and use it in GitHub Desktop.
Save selfsame/6966702 to your computer and use it in GitHub Desktop.
public ShaderProgram MakeShader(){
String vertexShader =
"attribute vec4 " + ShaderProgram.POSITION_ATTRIBUTE + ";\n"
+ "attribute vec4 a_color ; \n"
+ "varying vec4 v_color ; \n"
+ "uniform mat4 u_worldView;"
+ "void main() \n"
+ "{ v_color = a_color; \n"
+ " gl_Position = a_position * u_worldView; \n"
+ "} \n";
String fragmentShader = "#ifdef GL_ES \n"
+ "precision mediump float; \n"
+ "#endif \n"
+ "varying vec4 v_color; \n"
+ "void main() \n"
+ "{ \n"
+ " gl_FragColor = v_color; \n"
+ "}";
return new ShaderProgram(vertexShader, fragmentShader);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment