Sign in to follow this  

[dx9] setting a shader constant?

This topic is 448 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

thanks for your reply

i've initially used the table but now i've switched to IDirect3DDevice9::SetVertexShaderConstantF

result = app.getDevice()->SetVertexShaderConstantF(0, &matWorldViewProj._11, 4);


but now I dont get the geometry on my screen anymore. it worked with the constant table

Share this post


Link to post
Share on other sites

thanks for your reply

i've initially used the table but now i've switched to IDirect3DDevice9::SetVertexShaderConstantF
 

result = app.getDevice()->SetVertexShaderConstantF(0, &matWorldViewProj._11, 4);

but now I dont get the geometry on my screen anymore. it worked with the constant table

 

It should be 16 in the last parameters of SetVertexShaderConstantF, not 4. A matrix is made of 16 floats. So your're just passing the only 4 elements, not the whole matrix. 

Share this post


Link to post
Share on other sites

It should be 16 in the last parameters of SetVertexShaderConstantF, not 4. A matrix is made of 16 floats. So your're just passing the only 4 elements, not the whole matrix.


https://msdn.microsoft.com/en-us/library/windows/desktop/bb174467%28v=vs.85%29.aspx?f=255&MSPPError=-2147217396

No, 4 is correct:
 

Number of four float vectors in the array of constants.


but now I dont get the geometry on my screen anymore. it worked with the constant table


Do you need to transpose your matrix?

Share this post


Link to post
Share on other sites

This topic is 448 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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