Original Post
Hi. I have a textured cube that I''m drawing on a black background. The cube''s vertices are saved in a vertex buffer in the format PositionTexturedNormal (this is C#, btw), so there''s no alpha blending information there or in the texture itself. I am trying to find a simple way to draw the cube at varying levels of transparency (I want it to fade away).
I''ve been reading the DX9 SDK docs (even the C++ ones) and I can''t figure out what exactly I need to do. I''m pretty sure what I want to do is called framebuffer alpha blending, since I want to draw the entire cube in a transparent way. How do I do this?
This is my pitiful attempt at setting it up:
dev.RenderState.AlphaBlendEnable = true;
dev.RenderState.BlendFactor = Color.FromArgb(128,128,128,128);
dev.RenderState.BlendOperation = BlendOperation.Max;
DrawBlock(b,x,y);
dev.RenderState.AlphaBlendEnable = false;
There are other settings that looked useful, but that I didn''t touch:
// dev.RenderState.AlphaSourceBlend = Blend.BlendFactor;
// dev.RenderState.AlphaDestinationBlend = Blend.BlendFactor;
I feel that I''m very close, as it seems the the RenderState.BlendFactor is the only setting that lets me direct the transparency with which the entire block is drawn. I''m not sure if I need to specify a blend operation or not...
Thanks for any help!
PS - I''m looking for a solution that doesn''t require changing the contents of my cube vertex buffer or texture information in any way. I just want to draw a semi-transparent cube...
----------------------------------------
Let be be finale of seem, seems to me.
----------------------------------------
Coding:
http://www.stanford.edu/~jjshed/coding
Miscellany:
http://www.stanford.edu/~jjshed