Re: Transparency in DX 9.0.

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



If you "manually copy" the bitmap, don't you care about 3D
render states, that would even not effect "D3D-copy operations".

D3D9 (in contrast to DD8) isn't focused on surface-handling, but
on GPU rendering 3D. It obviously isn't meant to be used for "playing"
with a collection of surfaces, the few 2D-copy mechanism found in D3D
mainly serve the purpose of getting texture data into the 3D pipeline
(and vice versa).

So you want the image to be copied to a texture (nothing else would
really make sense in D3D)? Then either lock() the surface of the
texture, and really do the manual copy (modified to include the
color-key operation you demand), or, as an alternative, you
could load the bitmap as it is to a texture, and "copy" it to a
final destination RT-texture, by using a screen aligned quad
plus pixel shader.

Gruss

Jan Bruns



<jturner1990@xxxxxxxxxxx> schrieb im Newsbeitrag news:1174839498.444695.307570@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hello,

I'm manually copying an 8-bit, palettized bitmap onto a small surface
(24x24).

The bitmap is a red ball shape on a black bakground. I do not want
the black background of the image to appear on my white front buffer/
surface.

I have set the following states to signify that black pixels are not
to be rendered:

g_pd3dDevice->SetRenderState(D3DRS_ALPHAREF, (DWORD)0x00000001);
g_pd3dDevice->SetRenderState(D3DRS_ALPHATESTENABLE, TRUE);
g_pd3dDevice->SetRenderState(D3DRS_ALPHAFUNC, D3DCMP_GREATEREQUAL);


** I do not want to use D3DXCreateTextureFromFileInMemoryEx or any of
the other D3DX-based functions.

The black background still appears. Why? How do you get simple
transparency (equivalent to the old-style ColorKey effect) in DX9?

Thanks,
J

.



Relevant Pages

  • Rendering Textures to Transformed Vertices
    ... I'm trying to render a 4-vertex square on a black background with a ... my texture doesn't show up. ... However, when I render the box I get a solid color, not the bitmap that ... For some reason it takes the first pixel in the image and ...
    (microsoft.public.win32.programmer.directx.graphics)
  • Use of 3d graphics in Web services (Help please)
    ... I would like to create a web service that would render 3d object (texture, light, ...) and return bitmap in a byte stream. ...
    (comp.graphics.api.opengl)
  • texture to a point
    ... Can anyone help me in projecting a texture to a point. ... loaded and I want to render that texture into a point. ... Bitmap bitmap; ...
    (comp.graphics.api.opengl)
  • How is the best way to draw a background
    ... what i need to know is the best way to render a bitmap onto the whole screen ... so that i can use a texture for my menu background, ... Prev by Date: ...
    (microsoft.public.win32.programmer.directx.graphics)
  • Re: Multitexturing problem on the Mac/Ubuntu Linux
    ... int sizeX; ... // Routine to read a bitmap file. ... void loadExternalTextures() ... // Create texture index array and load external textures. ...
    (comp.graphics.api.opengl)