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

apache - 504 Gateway Time-out The server didn't respond in time. How to fix it? -

c# - .net WebSocket: CloseOutputAsync vs CloseAsync -

c++ - How to properly scale qgroupbox title with stylesheet for high resolution display? -