C # + GL Control blend background with form

I work with C # and OpenTK libraries for OpenGL, I want to mix GLControl with an image placed as a background.

* EDIT *

I solved the problem of loading the original image by changing the method, so now I use raster and raster structures:

Bitmap bitmap = new Bitmap("image.png");
BitmapData data = bitmap.LockBits(new System.Drawing.Rectangle(0, 0, bitmap.Width, bitmap.Height),
         ImageLockMode.ReadOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb);

I'm sure my png source has 4 channels and the alpha value is 0 on a black background

this is the original image: http://imageshack.com/a/img801/517/u2z8.png

And here is the problem: http://imageshack.com/a/img40/1729/zezj.jpg

top is a texture using GLControl, and the bottom is a Picturebox of a Windows shape, what I'm trying to do is that the black background of GLControl becomes transparent.

Blend GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha);, , .

, ?

GL.TexEnv(TextureEnvTarget.TextureEnv, TextureEnvParameter.TextureEnvMode,GL_MODULATE);
+1
1

- OpenGL WPF . , , , :

  • GLControl, (.. WindowsFormsHost)
  • framebuffer ( )
  • OpenGL framebuffer
  • GL.GetTexImage2D()
  • WPF PictureBox

, WPF PictureBox, .

(Nitpicking: , OpenTK.GLControl, Tao.SimpleGlControl. , API .)

+4

All Articles