   how can d3d9 provide something like overlay in ddraw7?
  What I want to implement is:The application writes texts on a window using GDI as usual, and sets the color key.The inside blends the window content onto a d3d9 surface and show in that window.When using ddraw7, I can easily set the color key and overlay to realize this.Now I want to use pixel shader, so it should be a d3dsurface9.I don''t want to change the code to d3d DrawText.I can use Id3dsurface9->GetDC() and provide the dc to the application.But to be able to getdc, the surface should not be A8R8G8B8, it should be X8R8G8B8, etc., so I can not alpha blend it directly.I can copy from X8R8G8B8 to A8R8G8B8, but that''s slow.I can blend it in the shader program, that''s the only solution I''ve found, it increases the shader length.Any better solution? 
quote:Original post by softimage  Now I want to use pixel shader, so it should be a d3dsurface9.I don''t want to change the code to d3d DrawText.Why? ID3DXFont is very efficient nowadays, and beats raw GDI hands down in performance.quote:I can blend it in the shader program, that''s the only solution I''ve found, it increases the shader length. By one instruction - copy some of the color components to alpha channel. If your target specs include pixel shader capability anyway, this doesn''t really matter.D3D doesn''t support hardware color keying, period. You''ll need to use some kind of blending if you are to emulate it, and alpha channel is the most straight-forward of these.One optimization you could do, if I didn''t convert you to ID3DXFont: draw the text to a texture, and use that texture to transfer the text to the backbuffer. You don''t presumably fill the screen with text, do you? Kind rgds,-Nik;quote:Original post by Nik02  One optimization you could do, if I didn''t convert you to ID3DXFont: draw the text to a texture, and use that texture to transfer the text to the backbuffer. You don''t presumably fill the screen with text, do you? Kind rgds,-Nik What do you mean by using the texture to transfer the text to the backbuffer?Do you mean setting the texture with the text onto a small object, instead of changing the format and blend onto the full screen?But it''s a pity that the position of the text is not fixed.A full screen covering is better. 