android - How can I change the color of a line loop in OpenGL? -


I am drawing a simple rectangular line loop using this call:

  GLES20 .glDrawElements (GLES20.GL_LINE_LOOP, Numbers, GLES20.GL_UNSIGNED_SHORT, getIndicesBuffer ());  

Now, the color of this line loop is black, how can I change it to any other color? Red, for example.

You have to change your piece, I would agree that you want to change the loop color per line.

Change your piece shader to:

  Uniform vec4 colors; Main () {gl_FragColor = color; }  

And before each glDrawElements, you must GLES20.glUniform4f (colorLoc, r, g, b, a); can call. The return value of colorLoc GLES20.glGetUniformLocation (program, "color") is; and r, g, b and A are red, green, blue and alpha values ​​that you want to have the color range in 0-1.


Comments

Popular posts from this blog

HTML/CSS - Automatically set height width from background image? -

php - Mysql Show Process - Sleep Commands and what to do -

c - What is the address of buf (the local variable in the main function)? -