# HLSL and D3DXSPRITE?

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

## Recommended Posts

Hey everyone, alright I'm very noobish when it comes to HLSL (well really d3d in general still...) As of right now I use D3DXSPRITE for doing 2d applications (I hope to get away from that... but I dunno if there's a reason b/c ill still have to use D3DX for other stuf *sob*) Anyway I wondered if I could do HLSL with that? And what kind of fun things can you do with HLSL (since I'm not too clear about it) isn't it like pixel shaders or something? Anyway, hopefully this isn't a very complex question but after a few more 2d games (side-scroller, rts, rpg) I will want to go into 3d (and i'm dreading it...) and this seems like an important topic Thanks!

##### Share on other sites
Shaders cannot be used with ID3DXSprite - sprite sets up its own rendering, internally. Anything that you will try to setup will be overridden. Shaders are an important topic, and you are correct - their learning curve is pretty steep. However, they let you do an incredible amount of things (just look at any games made in the last few years).

Check out these introductory HLSL tutorials. Don't expect to become a shader guru all at once. Not only do you need to learn the HLSL language, you need to learn all the math behind 3D lighting and shading.

##### Share on other sites
Actually, you can easily use a pixel shader with D3DXSprite. Just remember to set it after you call pSprite->Begin(...). Your shader should look something like this:

sampler tex : register(s0);float4 MyPixelShader(float4 color : COLOR, float2 texCoord : TEXCOORD0) : COLOR{    return tex2D(tex, texCoord) * color;}

xyzzy

##### Share on other sites
Quote:
 Original post by xyzzy00Actually, you can easily use a pixel shader with D3DXSprite. Just remember to set it after you call pSprite->Begin(...). Your shader should look something like this:sampler tex : register(s0);float4 MyPixelShader(float4 color : COLOR, float2 texCoord : TEXCOORD0) : COLOR{ return tex2D(tex, texCoord) * color;}xyzzy

yayyyyy i am really happy to hear this; now ill have to play around with it... i'm guessing i still need to setup the renderstates and all that jazz?

1. 1
Rutin
36
2. 2
3. 3
4. 4
5. 5

• 11
• 15
• 12
• 14
• 9
• ### Forum Statistics

• Total Topics
633353
• Total Posts
3011485
• ### Who's Online (See full list)

There are no registered users currently online

×