且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

opengl es:绘制带有渐变渐变的纹理

更新时间:2023-11-08 11:48:34

您可以设置glColorPointer(或glVertexAttribPointer),而不是在绘制四边形之前调用glColor4f,以便四边形的四个顶点中的每个顶点具有不同的alpha值.值吗?

Instead of calling glColor4f before drawing the quad, can you set a glColorPointer (or glVertexAttribPointer), such that each of the four vertices of your quad get a different alpha value?

即RGBA值:

 (x,x,x,1)       (x,x,x,0)
     -----------------
     |               |
     |               |
     |               |
     |               |
     |               |
     |               |
     -----------------
  (x,x,x,1)      (x,x,x,0)

这将为您提供从右到左的alpha渐变.

This would give you an alpha gradient from right to left.