dwmkerr / sharpgl

Use OpenGL in .NET applications. SharpGL wraps all modern OpenGL features and offers a powerful scene graph to aid development.
MIT License
770 stars 300 forks source link

Added NV_DX_interop(2) and a sample application for WPF #116

Closed LittleFox94 closed 4 years ago

LittleFox94 commented 9 years ago

This closes #32 The changes in this pull-request are mostly the same, but this one can be merged and the repo isn't deleted ;)

mach22 commented 9 years ago

Will you add even the second commit with the integration of NV_DX_interop2 extension and WPF sample?

LittleFox94 commented 8 years ago

bump

adevar77 commented 6 years ago

This is much faster than the original implementation!

To make it work on Intel HD Graphics 5500, I had to add a call to DXSetResourceShareHandleNV in method FastGLControl.ResizeRendering - like so:

` IntPtr textureShareHandle = IntPtr.Zero; _texture = new Texture(_device, (int)ActualWidth, (int)ActualHeight, 1, Usage.None, Format.X8R8G8B8, Pool.Default, ref textureShareHandle); _renderBuffer = _texture.GetSurfaceLevel(0);

_gl.DXSetResourceShareHandleNV(_texture.ComPointer, textureShareHandle);

_glRenderBufferHandle = _gl.DXRegisterObjectNV(_dxDeviceGLHandle, _texture.ComPointer, _glRenderBufferName, OpenGL.GL_TEXTURE_2D, OpenGLExNV.WGL_ACCESS_READ_WRITE_NV); `

Do you think it might be possible to add depth test support? The following call does not help - probably because there is no depth buffer: _gl.Enable(OpenGL.GL_DEPTH_TEST);

dwmkerr commented 4 years ago

This is merged now! Am finally doing some spring cleaning, the PR was #175 in the end as there were conflicts

LittleFox94 commented 4 years ago

Wow - didn't think it'll still make it :D

dwmkerr commented 4 years ago

Yes, it's been quite a while, so sorry about that!

LittleFox94 commented 4 years ago

@dwmkerr it's ok, no worries^^ was just very surprised when I saw that email :D

Just a shame I didn't manage to change the name in the commits before merging them