On OSX have a custom transparent window, with a NSView inside of it that manages OpenGL drawing:
public class MyCustomOpenGLView : NSView
{
NSOpenGLContext openGLContext;
// ...
}
I have set the following (using Xamarin):
openGLContext.SurfaceOpaque = false;
Which is equivalent to:
GLint opaque = 0;
[[[wnd contentView] openGLContext] setValues:&opaque forParameter:NSOpenGLCPSurfaceOpacity];
I have also set the "Opaque" property on the NSView that manages OpenGL to false:
public override bool IsOpaque
{
get
{
return false;
}
}
Which is equivalent to:
@implementation NSOpenGLView (Opaque)
-(BOOL)isOpaque {
return NO;
}
@end
Then during the rendering I set the clear color to transparent:
GL.ClearColor(Color.Transparent);
GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);
// Draw shape here...
The view renders the shape with a transparent background but I can still click on the transparent areas. I want to be able to click through the transparent areas.
I tried overriding the HitTest method and the NSView is indeed catching my mouse clicks on the transparent areas. What am I doing wrong here? Any help would be much appreciated!