Okay, so I simplified this issue because nothing it was doing was making any sense. Originally I was drawing 5 buttons...4 along the top of my render window, one on the right side.
So I removed all of them but one, and changed the colors that I was using to 4 different colors so I could get a better idea of what this is doing. This worked for 1 button. I drew the second button, but nothing happened...when I rendered the third one, an inverted gradient rectangle with the new colors was drawn underneath buttons 2 and 3. So I am close, to something...I just don't know what.
In my button class I am drawing a normal grey rectangle shape. All that is working, and when I use multiple instances of my button, it displays them all at the top like it is supposed to.
On that button class I am wanting to make it gradient instead. So now I am doing this:
Dim col1 As New SFML.Graphics.Color(255, 0, 0, 255) ' red
Dim col2 As New SFML.Graphics.Color(0, 0, 255, 255) ' blue
Dim col3 As New SFML.Graphics.Color(255, 255, 0, 255) ' yellow
Dim col4 As New SFML.Graphics.Color(0, 255, 0, 255) ' green
Dim v0 As Vertex = New Vertex(New Vector2f(Me.Location.X, Me.Location.X), col1)
Dim v1 As Vertex = New Vertex(New Vector2f(Me.Size.Width, Me.Location.X), col2)
Dim v2 As Vertex = New Vertex(New Vector2f(Me.Size.Width, Me.Size.Height), col3)
Dim v3 As Vertex = New Vertex(New Vector2f(Me.Location.X, Me.Size.Height), col4)
target.Draw({v0, v1, v2, v3}, PrimitiveType.Quads)
Now when I draw 1 button, here are my results:
However, when I draw all 4 buttons at the top, this is my results:
As you can see, the locations and sizes of the buttons are correct because it is still drawing the grey rectangle shapes in their respective locations. What I am not understanding is why I am not able to draw the gradient where it is supposed to be on each of the individual buttons.
Does anything look "off" with the vertex locations I am drawing the gradient in my button class?