2012-07-04 29 views

回答

1

讀完代碼後:暫時不能。初始化着色器類沒有公開,但我向Haehn提出了一個問題,將其導出爲公共,以便可以實例化一個着色器。此外,它需要2個設置片段和頂點源的setter,並刪除在着色器源中使用的所有屬性/制服的測試。

請注意,使用當前代碼,您無法將參數添加到着色器(順便說一句,應該有足夠的任何用途,您可以在「屬性」和「制服」中看到它們here)。

要使用它,在這之後,我會說:

var r = new X.renderer3D(); //create a renderer 
r.init(); //initiate it 
var sh = new X.shaders(); // create a new par of shaders 
/* here use the futur setters to set sources from a string or a file */ 
r.addShaders(sh); // this set the shaders for the renderer and try to compile them 
// DO NOT call init anymore or it would erase the current shaders and replace them by default ones 
/* 
Any code to fill the scene, etc... 
*/ 
r.render(); 

但需要等待3個改變我在這篇文章開始時所說的。我在等Haehn的消息。