Sign in to follow this  

DrawPrimitive sprite move

This topic is 3745 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

Hello I'm trying move a sprite using custom vertex using D3DFVF_XYZRHW. my code work to move sprite only when i set the position in OnCreate of my window... dont have a way to move it in runtime? my code is here: http://www.lordzero.co.nr/tmp/DrawPrimitive.zip Greets

Share this post


Link to post
Share on other sites
I haven't looked at your code; you're more likely to get people looking at it if you paste the relevant parts here in [ source ] tags.

I bet you're trying to use a transform matrix to move your vertices. D3DFVF_XYZRHW vertices don't have any transformations applied to them, so you'll either have to update the vertex buffer every frame to move them (Make sure you use a dynamic VB), or use an orthogonal projection matrix and use untransformed vertices.

Share this post


Link to post
Share on other sites
Quote:
Original post by Evil Steve
I haven't looked at your code; you're more likely to get people looking at it if you paste the relevant parts here in [ source ] tags.

I bet you're trying to use a transform matrix to move your vertices. D3DFVF_XYZRHW vertices don't have any transformations applied to them, so you'll either have to update the vertex buffer every frame to move them (Make sure you use a dynamic VB), or use an orthogonal projection matrix and use untransformed vertices.


yeah, updatting the vertex buffer every frame already working! :)

with orthogonal projection the performance is better of D3DFVF_XYZRHW vertices?

and about the performance... do u know how to otmize my vertex using D3DFVF_XYZRHW? such as batching or other issue...

Greets

Share this post


Link to post
Share on other sites
Quote:
Original post by lordzero
with orthogonal projection the performance is better of D3DFVF_XYZRHW vertices?

and about the performance... do u know how to otmize my vertex using D3DFVF_XYZRHW? such as batching or other issue...

Greets
Orthogonal projection will be a bit more efficient, yes - and you get rotation for "free".

As far as optimising vertex usage goes, it's just the same as any other format. Indexed is better, and ordering vertices to use the vertex cache efficiently is good. That's about it.

Share this post


Link to post
Share on other sites
Quote:
Original post by Evil Steve
Quote:
Original post by lordzero
with orthogonal projection the performance is better of D3DFVF_XYZRHW vertices?

and about the performance... do u know how to otmize my vertex using D3DFVF_XYZRHW? such as batching or other issue...

Greets
Orthogonal projection will be a bit more efficient, yes - and you get rotation for "free".

As far as optimising vertex usage goes, it's just the same as any other format. Indexed is better, and ordering vertices to use the vertex cache efficiently is good. That's about it.



thanks

Share this post


Link to post
Share on other sites
Quote:
Original post by Evil Steve
Quote:
Original post by lordzero
with orthogonal projection the performance is better of D3DFVF_XYZRHW vertices?

and about the performance... do u know how to otmize my vertex using D3DFVF_XYZRHW? such as batching or other issue...

Greets
Orthogonal projection will be a bit more efficient, yes - and you get rotation for "free".

As far as optimising vertex usage goes, it's just the same as any other format. Indexed is better, and ordering vertices to use the vertex cache efficiently is good. That's about it.


hey other guy talked about that 3D projection can be not good because won't give pixel-perfect results mainly because you need to use direct mapping of textels to pixels.

what do u think about it?

Share this post


Link to post
Share on other sites
It's fine so long as you offset all your vertices by -0.5 in X and Y. There's a bit in the SDK Docs about it.

EDIT: ID3DXSprite uses an orthogonal projection matrix, and my engine code uses this method too. Using transformed vertices means you're not making use of part of the GPU and doing all the hard work on the CPU (Only really an issue with rotated quads that is) - something hardware vertex processing was designed for in the first place.

Share this post


Link to post
Share on other sites

This topic is 3745 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