Helios's picture

[VB.NET] Transparent overlay - SwapBuffers changes background color

I'm trying to create a transparent overlay, which I have and works fine, but when I add the "SwapBuffers" part, the background color is changed to black.

What I've done: I created a normal form, made it transparent, made it maximized and set it to "no border". Then I added the GLControl, docked it to all sides & set the backcolor to "transparent".

Then on the "Paint" event, I do this (just as a test):

'DrawLine(R, G, B, A, X, Y, Z, LineWidth)
 DrawLine(100, 0, 0, 100, 20, 20, 20, 1)

Then when I run it the overlay goes black... If I out-comment the SwapBuffer everything works fine, but then nothing will get drawn...

So what am I doing wrong?

Best regards


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Helios's picture

Alright, so after a lot of searching, reading and testing, I've come to the conclusion that this just isn't going to happen. I'm going to give this a couple of more days and then pray for a miracle.

I found out that the way to do it, simply won't work with OpenTK, maybe someone will know what I'm doing wrong now and actually answer this time.
The gerneral answer is:

GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha)
GL.ClearColor(0, 0, 0, 0)

I've tried a lot of variations of the code above and it just doesn't want to work. I've been moving the code back and forth from the paint event & the load event.