Alex Rivera | Logout

Pass custom attributes to a custom fragment shader

Asked 2012-07-19T18:03:30.080
8

Is it possible to pass custom attributes to a fragment shader, i know i can pass attributes via GLES20.glVertexAttribPointer to the vertex shader, but how can i pass a float[] to the fragment shader?

Edit
Report

1 Answer

1

Tim's answer is of course correct.

A possible workaround would be to store your float values in a 2D texture and pass the texture coordinates (and the number of values) to the shader. However, this can become really slow if you have large numbers of float values per vertex (because of all the texture lookups per fragment). Another problem is that this results in very large textures if you have a lot of vertices. Anyway, in some cases this approach can be useful.

answered 2012-07-20T08:29:21.593

Your Answer