Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

D3DXVECTOR3

Direct3D9 - ID3DXSprite, i dont see anything

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

I gave up on using my own billboards, and wanted to try ID3DXSprite's. All goes well, no warnings, crashes etc. but i dont see anything... Anyone see whats wrong wits this code??? I create the ID3DXSprite like this : ID3DXSprite gFlareSprite; D3DXCreateSprite(pd3dDevice, &gFlareSprite)
void DXCorona::RenderWSprite(LPDIRECT3DDEVICE9 pd3dDevice)
{
	RECT rc = {0.0f, 0.0f, 5.0f,5.0f};

	D3DXMATRIX  matWorld, matView;
	pd3dDevice->GetTransform(D3DTS_WORLD, &matWorld);
	pd3dDevice->GetTransform(D3DTS_VIEW, &matView);

	gFlareSprite->SetWorldViewRH(&matWorld, &matView);
	gFlareSprite->Begin(D3DXSPRITE_BILLBOARD);
	gFlareSprite->Draw(gFlareTextures[Flares[0].dwCoronaTexture], &rc, NULL, &Flares[0].vPos, D3DCOLOR_RGBA(255,255,255,255));
	gFlareSprite->End();
}
I use a RH axis system Edit i made some changes and now i see a black quad. I hvae updated the code above. [edited by - D3DXVECTOR3 on January 13, 2004 4:46:15 PM] [edited by - D3DXVECTOR3 on January 13, 2004 6:13:07 PM]

Share this post


Link to post
Share on other sites
Advertisement
LOL i got it... sort of. I should read more carefull. The problem is in the size of rc. The Rectangle is the part of the texture you want 2 use, as in the SDK : "Pointer to a RECT structure that indicates the portion of the source texture to use for the sprite."

The problem i have now is that by specifying NULL the created sprite is HUGE 64*64. How can i scale it down easy, fast and efficiently

[edited by - D3DXVECTOR3 on January 14, 2004 6:03:16 AM]

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
How about using scale argument of Draw method?

Share this post


Link to post
Share on other sites
Easiest way would be to scale down your source texture to whatever size you want. The sprite will be created at the size of the texture.


I like pie.

Share this post


Link to post
Share on other sites
The scale in the draw method in Direct3D 9 is removed. I tried using to scale down the texture but it the texture looks really bad that way.

Draw method of ID3DXSprite in Direct3D9:
========================================================
HRESULT Draw(LPDIRECT3DTEXTURE9 pTexture,
CONST RECT *pSrcRect,
CONST D3DXVECTOR3 *pCenter,
CONST D3DXVECTOR3 *pPosition,
D3DCOLOR Color
);
========================================================

[edited by - D3DXVECTOR3 on January 14, 2004 6:12:04 PM]

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
We must be looking at different draw methods, since one I am seeing looks like this:

HRESULT Draw(
LPDIRECT3DTEXTURE9 pSrcTexture,
CONST RECT *pSrcRect,
CONST D3DXVECTOR2 *pScaling,
CONST D3DXVECTOR2 *pRotationCenter,
FLOAT Rotation,
CONST D3DVECTOR2 *pTranslation,
D3DCOLOR Color
);

Share this post


Link to post
Share on other sites
gFlareSprite->Begin(D3DXSPRITE_BILLBOARD);
D3DXSPRITE_BILLBOARD -> Is possibly the problem.
Look @ the Documention in the D3D SDK Help file for other parameters that can be passed, you may also want to simply try
gFlareSprite->Begin();
I''ve had similar problems that the sprite would not be displayed because of the parameters being passed to this function.

Share this post


Link to post
Share on other sites
The scaling method was taken out... excuse me? What black magic has been enabling me to use it then?

Here's a random call to draw from my particle system. I'm using directX9.

g_pSprite->Draw( Graphic[X].Texture, NULL, NULL, NULL, NULL, &Location, D3DCOLOR_ARGB( 255, 255, 255, 255) );

Try using Draw as though it had a Rotate method, even though your (mine does) copy of the sdk doesn't mention it.

[edited by - ShadowP13 on January 19, 2004 3:46:39 PM]

Share this post


Link to post
Share on other sites

  • 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!