Skip to main content
gamedev.net
🔒 Locked

Visual basic blend problem

Started by Starfalcon2 Jul 12, 2006 at 11:15 PM 1 replies 800+ views
Original Post
Starfalcon2
Starfalcon2
I tried to blend the two textures; however, the codes should be select m_Texture(3) to render instead m_Texture(9). It rendered black as it doesn't exist. It is no sence to me because it should be simple. Maybe I forget some defaults or like that. I use visual basic 2003 with directx 9. //******** Dim position As Point = New Point(100, 100) Dim vertex(4) As customvertex1 vertex(0) = CreateFlexVertex(position.X, position.Y, 0, 1, 0, 0) vertex(1) = CreateFlexVertex(position.X + 256, position.Y, 0, 1, 1, 0) vertex(2) = CreateFlexVertex(position.X + 256, position.Y + 256, 0, 1, 1, 1) vertex(3) = CreateFlexVertex(position.X, position.Y + 256, 0, 1, 0, 1) Dim buffer As VertexBuffer = New VertexBuffer(GetType(customvertex1), 8, Directx9, Usage.WriteOnly, FVF_CustomVertex, Pool.Managed) Dim verts(4) As customvertex1 verts = buffer.Lock(0, 0) verts(0) = vertex(0) verts(1) = vertex(1) verts(2) = vertex(2) verts(3) = vertex(3) buffer.Unlock() Directx9.RenderState.Lighting = False Directx9.RenderState.SourceBlend = Blend.SourceAlpha Directx9.RenderState.DestinationBlend = Blend.InvSourceAlpha Directx9.RenderState.AlphaBlendEnable = True Directx9.SetStreamSource(0, buffer, 0) Directx9.VertexFormat = FVF_CustomVertex Directx9.SetTextureStageState(1, TextureStageStates.ColorOperation, TextureOperation.SelectArg1) Directx9.SetTexture(1, m_Texture(3)) Directx9.SetTexture(0, m_Texture(9)) Directx9.BeginScene() Directx9.DrawPrimitives(PrimitiveType.TriangleFan, 0, 2) Directx9.EndScene() Directx9.SetTextureStageState(1, TextureStageStates.ColorOperation, TextureOperation.Disable) buffer.Dispose()
Supernat02
Supernat02
You told it to pick color argument 1 from stage 1, but you didn't specify what argument 1 is. Try adding this line and see if it helps:
Directx9.SetTextureStageState(1, TextureStageStates.ColorArgument1, TextureArgument.TextureColor)

Chris
Chris ByersMicrosoft DirectX MVP - 2005

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.