Sign in to follow this  
tomwindcloud

How to use shader fragments within effect??

Recommended Posts

tomwindcloud    122
I searched microsoft directx SDK and the forum, couldn't find how to use shader framents with effect. I know in SDK have some info about this, but it isn't clear. And the sample in SDK with fragments use pure HLSL, no effect. Basically, i think effects is more convenient than pure HLSL.Now, my quesition is: 1. Use fragment in effect is Ok? or no? 2. How to use Fragments with effect? thanks in advance! tomwindcloud [Edited by - tomwindcloud on November 27, 2005 8:01:34 PM]

Share this post


Link to post
Share on other sites
tomwindcloud    122
More accurate, say i have linked a vertex shader with LinkVertexShader function. In SDK doc, i can find this: The vertex shader needs to be set in the effect before rendering.
But how to set the vertex shader in the effect???? I can't find any function or interfaces can do it.

Share this post


Link to post
Share on other sites
centipede    304
Quote:
Original post by tomwindcloud
But how to set the vertex shader in the effect???? I can't find any function or interfaces can do it.

You can use the SetValue() method to do this. It takes a pointer to any kind of data, including shader programs.

Share this post


Link to post
Share on other sites
tomwindcloud    122
Quote:
Original post by centipede
Quote:
Original post by tomwindcloud
But how to set the vertex shader in the effect???? I can't find any function or interfaces can do it.

You can use the SetValue() method to do this. It takes a pointer to any kind of data, including shader programs.


thanks!! I'll try it. thanks again.

Share this post


Link to post
Share on other sites
tomwindcloud    122
Quote:
Original post by centipede
Quote:
Original post by tomwindcloud
But how to set the vertex shader in the effect???? I can't find any function or interfaces can do it.

You can use the SetValue() method to do this. It takes a pointer to any kind of data, including shader programs.


I try to use SetValue, but failed!. This is as follow:
IDirect3DVertexShader9 *g_pShader. is a right vertexshader.
1. Get the vertexshader buffer .
UINT size;
ID3DXBuffer* pData;
g_pShader->GetFunction(NULL, &size);
D3DXCreateBuffer(size, &pData);
V_RETURN( g_pLinkedShader->GetFunction(pData, &size) );
2. Set the vertexshader in effect.
g_pEffect->SetValue(g_hTestVertexShader, pData, size);
//hTestVertexShader is a D3DXHANDLE
but it failed.

How to do it?? Any suggestions??

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this