how to do the color keying in d3d9?
In ddraw, I can set a color key for the overlay.
How can I do the same thing in d3d9?
I want to use the color, not the alpha channel to determine which pixel should be displayed.
D3d don''t support colorkeys so you have to use the alpha channel, but it''s really simple. Just enable alpha, lock the texture you want a colorkey on. Scan trough the pixels and set the alpha bits to zero where you find the color you want to be transparent.
quote:Original post by Nik02
It is also worth noting that most D3DX loader functions do that part automatically.
You mean the ID3DX interface?
What I want to do is to write text onto a window using GDI,
then blend a d3d9 surface decoded from a video file onto that window,
overlaying the text on the surface.
It''s simple when using ddraw overlay.
1.
But what''s the fastest way when using d3d9?
Locking the texture and changing pixel-by-pixel seems not efficient.
2.
What''s the fastest way to get the content of the window into a texture?
1: Not using GDI at the speed critical phase, instead rendering the font to a texture and drawing the text as quads. You can of course use GDI to make the texture font, as at load time you don''t have so much performance pressure.
Again, D3D has the ID3DXFont interface which does the optimized drawing and caching automatically.
2: Not recommended at all. Try to figure out a way in which all possible data stays in video memory (textures, multiple render targets and pixel shaders help here).
-Nik
Again, D3D has the ID3DXFont interface which does the optimized drawing and caching automatically.
2: Not recommended at all. Try to figure out a way in which all possible data stays in video memory (textures, multiple render targets and pixel shaders help here).
-Nik
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement