Sign in to follow this  
papulko

D3D10 Sprites and primitive topology?

Recommended Posts

papulko    1418
Hi everyone.

I have been having a problem with text rendering for a while now, and can't seem to figure out what I'm doing wrong. I've managed to get a textured spinning pyramid up and running, but whenever I put the code specified below within my rendering loop, weird things happen. The text string i've defined gets output just like I want it, while the spinning pyramid has been replaced by a single dot moving along the same path as the pyramid used to. Same goes when I remove the DrawText method. I tried updating the primitive topology right after the pFontSprite->End(); resulting in the pyramid getting drawn again, but this time with its texture completely messed up alignment-wise.

[code]


pFontSprite->Begin(D3DX10_SPRITE_SORT_TEXTURE);
pFont->DrawText(pFontSprite, (LPCWSTR)ws, -1, &r, DT_NOCLIP, D3DXCOLOR(0.0f,1.0f,0.0f,1.0f));
pFontSprite->End();
[/code]

Does anyone have any idea on what could be wrong in this case? I know it's not much to go on right now. Thanks in advance.

Share this post


Link to post
Share on other sites
Texus    248
[color="#000000"]I don't know much about sprites, but when using text you should restore some things afterwards like this:

[code]
pDevice->OMSetDepthStencilState(0, 0);
pDevice->OMSetBlendState(0, 0, 0xffffffff);
pDevice->IASetInputLayout(pInputLayout);
pDevice->IASetPrimitiveTopology(D3D10_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
[/code]

Try to also pass D3DX10_SPRITE_SAVE_STATE as a parameter for pFontSprite->[/color][color="#000000"]Begin.
I hope this will help you.[/color]

Share this post


Link to post
Share on other sites
papulko    1418
resetting the depth stencil state and blend state settled it, thanks alot for helping out [img]http://public.gamedev.net/public/style_emoticons/default/rolleyes.gif[/img]

(edit: and the input layout also)

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