Sign in to follow this  
Cluq

.fx and d3dxsprite tutorial

Recommended Posts

I am interested in applying a pixel shader to my 2d game (a .fx file). I am using d3dxsprite to draw the images on the screen. Does anyone know of a good tutorial to do this? Or do any of you have the time to list some key functions I need to have a closer look at? As far as I can see, you load the .fx file using D3DXCreateEffectFromFile() - but how do you use that resulting D3DXEFFECT object? - I thought you used d3dDevice->setPixelShader() to add the shader...? *me confused* And does all this play nicely together with the d3dxsprite? A lot of questions, I know. Hopefully some of you can point me in the right direction. Best regards, Cluq.

Share this post


Link to post
Share on other sites
I'm not sure about this, but I think that the I3DXSprite interface is using D3DFVF_XYZRHW and is therefore ignored by the programmable pipeline.

I do recall that you can bypass this, but I'm not sure

Share this post


Link to post
Share on other sites
Quote:
Original post by Wixner
I'm not sure about this, but I think that the I3DXSprite interface is using D3DFVF_XYZRHW and is therefore ignored by the programmable pipeline.

I do recall that you can bypass this, but I'm not sure

using D3DFVF_XYZRHW, or transformed vertices, only bypasses the Vertex Processing portion of the pipeline. You can still use a Pixel Shader.

The no-VS part can't be bypassed.

As for the original question: If you want to learn about the Effect framework, there are many, many tutorials around, Google should be very helpful with that.

Effect interface integration with ID3DXSprite isn't as simple, though. I'm not aware of any tutorials, but I have done it before, so it is possible. I'd suggest, that once you get your head around using the Effect Interface for 3D, you try to use it with ID3DXSprite. If you encounter problems then, you can post back with specific issues and I, or one of the many other here, will be glad to lend a hand.

Hope this helps.

Share this post


Link to post
Share on other sites
I think that the easiest way to use shaders in 2D would be to enroll your own vertex buffer instead of trying to used it with ID3DXSprite.

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