Jump to content

Failed to create effect


Ingo Chou
 Share

Recommended Posts

Hi,

 

I create effect with API :

 

var eff =  engine.createEffect("shader/myfx", ["pos","nor","uv"], ["wmat", "vmat", "pmat"], ["bumpsamper", "diffsamper"], "");

 

if(!eff.isReady()) {return false;}

 

But failed. It always returns false;

 

What causes it?

 

How can I get the error information ?

 

Thanks for any help?

 

Link to comment
Share on other sites

First, it looks like createEffect is asyncronous, because it is loading files, then compiling.  Your code is not valid. You need to assign callbacks to the createEffect() method:

https://github.com/BabylonJS/Babylon.js/blob/master/src/babylon.engine.ts#L1236

 

2nd, the effect is passed in the callbacks, so you could check getCompilationError() method:

https://github.com/BabylonJS/Babylon.js/blob/master/src/Materials/babylon.effect.ts#L142

Link to comment
Share on other sites

Thanks for your reply!

 

I set onCompiled callback and onError callback like this:

 

engine.createEffect("shader/myfx", ["pos","nor","uv"], ["wmat", "vmat", "pmat"], ["bumpsamper", "diffsamper"], "", function(){alert("compiled")}, function(){alert("error")} );

 

But the callbacks have never been called.

 

And it's state is always NOT READY.  

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...