Jump to content
  • Advertisement
Sign in to follow this  
-justin-

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.

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

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 this post


Link to post
Share on other sites
Advertisement
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 this post


Link to post
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 this post


Link to post
Share on other sites
Quote:
Original post by xyzzy00
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


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?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!