官网：古典小说网 gudianxiaoshuo.com
官网：你真正需要下载的软件 需要下载站 needdown.com
网站大全
绿色导航

1 片段着色器使用统一变量

      char fShaderStr[] =
      "#version 300 es                              \n"
      "precision mediump float;                     \n"
      "uniform float rColor;"
      "uniform float gColor;"
      "out vec4 fragColor;                          \n"
      "in  vec4 tranglePos;    \n"
      "void main()                                  \n"
      "{                                            \n"
      "    fragColor = vec4(rColor,gColor,0.6,1.0 ); \n"
      "}                                            \n";

2 Draw函数中获得统一变量位置，然后设置统一变量

      nLocation=glGetUniformLocation(userData->programObject,"rColor");
      glUniform1f(nLocation, rColor);
      nLocation=glGetUniformLocation(userData->programObject,"gColor");
      glUniform1f(nLocation, gColor);