Jump to content
  • Advertisement

istallion

Member
  • Content Count

    8
  • Joined

  • Last visited

Community Reputation

122 Neutral

About istallion

  • Rank
    Newbie

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. istallion

    Vertex alpha blending

    Perfect. Texturefactor is working too.
  2. I want to fade a texture from 100% transparent to 100% opaque. I've played with the renderstate until I'm blue in the face, but I can't get any transparency. The foreground texture is only getting shaded black in one of the corners. The sample code in MSDN doesn't even mention that you need to set the alpha operations & arguments, but many others have. The results are the same either way. CustomVertex.PositionColoredTextured[] verts; device.RenderState.Lighting = false; device.RenderState.ZBufferEnable = false; device.RenderState.AlphaBlendEnable = true; device.RenderState.AlphaSourceBlend = Blend.SourceAlpha; device.RenderState.AlphaDestinationBlend = Blend.InvSourceAlpha; device.TextureState[0].AlphaOperation = TextureOperation.Modulate; device.TextureState[0].AlphaArgument1 = TextureArgument.TextureColor; device.TextureState[0].AlphaArgument2 = TextureArgument.Diffuse; device.VertexFormat = CustomVertex.PositionColoredTextured.Format; for (int i = 0; i < 256; i++) { device.Clear(ClearFlags.Target | ClearFlags.ZBuffer, System.Drawing.Color.Aqua, 1.0f, 0); //Begin the scene device.BeginScene(); SetupMatrices(); verts = (CustomVertex.PositionColoredTextured[])vb1.Lock(0, LockFlags.None); verts[0].Color = Color.FromArgb(255 - i, 0, 0, 0).ToArgb(); verts[1].Color = Color.FromArgb(255-i, 255, 255, 255).ToArgb(); verts[2].Color = Color.FromArgb(255-i, 255, 255, 255).ToArgb(); verts[3].Color = Color.FromArgb(255-i, 255, 255, 255).ToArgb(); vb1.Unlock(); device.SetStreamSource(0, vb1, 0); device.SetTexture(0, picTex[currentArrIndex]); device.DrawPrimitives(PrimitiveType.TriangleStrip, 0, 2); //End the scene device.EndScene(); // Update the screen device.Present(); }
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!