Beispiel #1
0
 public bool setShaders(glShader fragment, glShader vertex)
 {
     if (fragment == null || vertex == null)
     {
         return(false);
     }
     if (mProgram != null)
     {
         mProgram.unuse();
         mProgram.Dispose();
         mProgram = null;
     }
     mFragmentShader = fragment;
     mVertexShader   = vertex;
     try {
         mProgram = glProgram.create();
         mProgram.attach(fragment);
         mProgram.attach(vertex);
         mProgram.link();
         mUniformCache.Clear();
     } catch {
         return(false);
     }
     return(true);
 }
Beispiel #2
0
 void initContext()
 {
     mContext        = new bloContext();
     mVertexShader   = glShader.fromFile(ShaderType.VertexShader, "shader/gradient-map.vp");
     mFragmentShader = glShader.fromFile(ShaderType.FragmentShader, "shader/gradient-map.fp");
     mContext.setShaders(mFragmentShader, mVertexShader);
     bloContext.setContext(mContext);
 }