.fx and d3dxsprite tutorial

Started by
2 comments, last by BornToCode 17 years, 6 months ago
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.
Advertisement
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
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.
Sirob Yes.» - status: Work-O-Rama.
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.

This topic is closed to new replies.

Advertisement