Created
December 6, 2011 02:13
-
-
Save dalinaum/1436382 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private RenderScriptGL glRenderer; //rendering context | |
private ScriptField_Point mPoints; //vertices | |
private ScriptField_VpConsts mVpConsts; //shader constants | |
... | |
ProgramVertex.Builder sb = new ProgramVertex.Builder(glRenderer); | |
String t = "varying vec4 varColor;\n" + | |
"void main() {\n" + | |
" vec4 pos = vec4(0.0, 0.0, 0.0, 1.0);\n" + | |
" pos.xy = ATTRIB_position;\n" + | |
" gl_Position = UNI_MVP * pos;\n" + | |
" varColor = vec4(1.0, 1.0, 1.0, 1.0);\n" + | |
" gl_PointSize = ATTRIB_size;\n" + | |
"}\n"; | |
sb.setShader(t); | |
sb.addConstant(mVpConsts.getType()); | |
sb.addInput(mPoints.getElement()); | |
ProgramVertex pvs = sb.create(); | |
pvs.bindConstants(mVpConsts.getAllocation(), 0); | |
glRenderer.bindProgramVertex(pvs); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment