transparence box?

Started by
1 comment, last by ktfsince1981 18 years, 4 months ago
How can i create a transparence box in directx 9 if my box is created using Vertex Buffer? Thx for helping me...
Advertisement
You must use a vertex format like this one:

#define D3DFVF_CUSTOMVERTEX(D3DFVF_XYZ|D3DFVF_NORMAL|D3DFVF_DIFFUSE)

typedef struct tagCUSTOMVERTEX{
D3DXVECTOR3 p;
D3DXVECTOR3 n;
DWORD Color;
}CUSTOMVERTEX;

you can put the color by calling the D3DCOLOR_ARGB(a, r, g, b) macro:

CUSTOMVERTEX Vertices[] =
{
//Position | Normal | Color
{-1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, D3DCOLOR_ARGB(144, 255, 25, 5),},
};
by changing the value of the <<a>> param you change the transparency of the
vertex.

set the D3DRS_ALPHABLENDENABLE render state to true
set the D3DRS_SRCBLEND render state to D3DBLEND_ something (look at the SDK).
set the D3DRS_DESTBLEND render state to D3DBLEND_something(like above).

i dont know if you got it but it's prety simple
look at the DirectX SDK.

by the way i'm not so sure that thats the way.
Give it a try.
no...it doesn't work...

anyway, thx a lot...

This topic is closed to new replies.

Advertisement