Jump to content
  • Advertisement

Archived

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

Scarface5013

drawing with quad ??

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

Advertisement
In ... Direct3D? You mean 2D graphics with the new DX Graphics arch? If so, check out ID3DXSprite, ID3DTexture8, D3DXCreateSprite and D3DXCreateTextureFromFileEx.

Do the whole D3D initialization thing, load the image you want to draw using D3DXCreateTextureFromFileEx, then (after ID3DDevice8::BeginScene()) call ID3DXSprite::Begin, render the texture using ID3DXSprite::Draw and passing the ID3DTexture8 as the first parameter, call ID3DXSprite::End and call ID3DDevice8::EndScene().

Seems like lots of work, but it becomes about as easy as using DirectDraw with a bit of practice. You can actually do some really cool stuff with 2D DXG8

Hope that helped!

Tom L

Share this post


Link to post
Share on other sites
You could do a SetViewport() to set the size of your rectangle, and then use Clear() to clear the viewport to a specified colour. But i dunno how efficient it''d be. Especially in mid-render - it''d prob. cause a pipeline stall.

HTH, Steve

Share this post


Link to post
Share on other sites
You can pass a rectangle to the clear function, so that it doesn''t clear the whole screen. That would probably work.
But I would do it the slightly slower to code, but more flexible way, of making a vertex buffer, and creating a rect with four vertices. That way, you can have alpha blending, and a colour gradient between different corners of the quad, and it doesn''t have to be rectangular. If you use the clear function, then you can''t do those (nice looking) things.
It shouldn''t take too long to code that in, probably worth it in the end.

John B

Share this post


Link to post
Share on other sites
You should use Clear only once per frame. The docs are "clear" on this subject...

Quoted:

Clear only when you MUST.



Laurent - http://www.lafaqmfc.com/
My little game: http://www.lafaqmfc.com/starshooter.htm

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!