For sample code putting the shaders in strings makes it easier to see
everything needed to understand the app. In practice if your shaders are
static you should indeed put them in your resources directory instead.


On Mon, Dec 10, 2012 at 10:38 PM, Harri Smått <har...@gmail.com> wrote:

> 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" <b...@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+unsubscr...@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+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en




-- 
Romain Guy
Android framework engineer
romain...@android.com

-- 
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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to