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" <[email protected]> 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 [email protected] > To unsubscribe from this group, send email to > [email protected] > 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 [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

