在绘制矩形的矩形上增加--给矩形四个顶点设置颜色(http://blog.csdn.net/gamecocos2dx/article/details/51490398)
{目录
给矩形四个顶点设置颜色
shader代码
调用
引用Shader中的属性(自己在Shader中写的一些需要传值的类型) glGet....
设置Shader数据(Shader什么类型就用什么类型设置内容) glU/A...
在原有的基础上增加画圆
}
shader代码
bool shaderInit(){
// varying 关键字: vs和fs共享数据(建议vs和fs中速写一致)
const char *vs={
"precision lowp float;"
"uniform mat4 _MVP;"
"attribute vec2 _position;"
"attribute vec4 _color;" //外边出入的颜色
"varying vec4 _outColor;" //共享颜色
"void main(){"
" vec4 pos= vec4(_position,0,1);"
" _outColor = _color;"
" gl_Position=_MVP* pos;"
"}"
};
const char *fs={
"precision lowp float;"
"varying vec4 _outColor;"
"void main(){"
" gl_FragColor&#