Re: [android-developers] cleaner shaders
I've been putting shader code into assets or raw resources for a long while. Writing your shaders as strings is a pain.
--
H
On Dec 11, 2012 12:29 AM, "bob" <bob@coolfone.comze.com> wrote:
-- I'm looking at the BasicGLSurfaceView example, and I'm thinking maybe the vertex shader and fragment shader ought to be stored as assets for readability.Right now they are like this:private final String mVertexShader ="uniform mat4 uMVPMatrix;\n" +"attribute vec4 aPosition;\n" +"attribute vec2 aTextureCoord;\n" +"varying vec2 vTextureCoord;\n" +"void main() {\n" +" gl_Position = uMVPMatrix * aPosition;\n" +" vTextureCoord = aTextureCoord;\n" +"}\n";private final String mFragmentShader ="precision mediump float;\n" +"varying vec2 vTextureCoord;\n" +"uniform sampler2D sTexture;\n" +"void main() {\n" +" gl_FragColor = texture2D(sTexture, vTextureCoord);\n" +"}\n";On iOS, they are stored in .vsh and .fsh files. I think we should do something like that. What do you guys think?--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home