drawing with quad ??
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
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
i know. i do it this way. but now i only want to paint an area in one color. a rectangle in blue for examlpe.
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
HTH, Steve
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
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
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
Quoted:
Clear only when you MUST.
Laurent - http://www.lafaqmfc.com/
My little game: http://www.lafaqmfc.com/starshooter.htm
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement