コード例 #1
0
        private void SetupDisplayLink()
        {
            if (displayLink != null)
            {
                return;
            }

            // Create a display link capable of being used with all active displays
            displayLink = new CVDisplayLink();

            // Set the renderer output callback function
            displayLink.SetOutputCallback(MyDisplayLinkOutputCallback);

            // Set the display link for the current renderer
            CGLContext     cglContext     = openGLContext.CGLContext;
            CGLPixelFormat cglPixelFormat = PixelFormat.CGLPixelFormat;

            displayLink.SetCurrentDisplay(cglContext, cglPixelFormat);
        }
コード例 #2
0
 public override void DrawInCGLContext (MonoMac.OpenGL.CGLContext glContext, CGLPixelFormat pixelFormat, double timeInterval, ref CVTimeStamp timeStamp)
 {
         GL.ClearColor (NSColor.Clear.UsingColorSpace (NSColorSpace.CalibratedRGB));
         GL.Clear (ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);
         GL.Enable (EnableCap.DepthTest);
         GL.Hint (HintTarget.LineSmoothHint, HintMode.Nicest);
         GL.Hint (HintTarget.PolygonSmoothHint, HintMode.Nicest);
         if (previousTime == 0)
                 previousTime = timeInterval;
         rotation += 15.0 * (timeInterval - previousTime);
         GL.LoadIdentity ();
         double comp = 1 / Math.Sqrt (3.0);
         GL.Rotate (rotation, comp, comp, comp);
         
         drawCube ();
         
         GL.Flush ();
         previousTime = timeInterval;
         GL.Disable (EnableCap.DepthTest);
         GL.Hint (HintTarget.LineSmoothHint, HintMode.DontCare);
         GL.Hint (HintTarget.PolygonSmoothHint, HintMode.DontCare);
         
         
 }
コード例 #3
0
				public override bool CanDrawInCGLContext (CGLContext glContext, CGLPixelFormat pixelFormat, double timeInterval, ref CVTimeStamp timeStamp)
                {
                        if (!animate)
                                previousTime = 0.0;
                        return animate;
                }
コード例 #4
0
                public override CGLPixelFormat CopyCGLPixelFormatForDisplayMask (uint mask)
                {
                        // make sure to add a null value
                        var attribs = new object [] { 
							CGLPixelFormatAttribute.Accelerated, 
							CGLPixelFormatAttribute.DoubleBuffer, 
							CGLPixelFormatAttribute.ColorSize, 24, 
							CGLPixelFormatAttribute.DepthSize, 16 };
                        
                        CGLPixelFormat pixelFormat = new CGLPixelFormat (attribs);
                        return pixelFormat;
                }
コード例 #5
0
	public CVReturn SetCurrentDisplay (CGLContext cglContext, CGLPixelFormat cglPixelFormat)
	{
		return CVDisplayLinkSetCurrentCGDisplayFromOpenGLContext (this.handle, cglContext.Handle, cglPixelFormat.Handle);
	}     
コード例 #6
0
ファイル: OpenGLLayer.cs プロジェクト: kangaroo/monomac
                public override CGLPixelFormat CopyCGLPixelFormatForDisplayMask (uint mask)
                {
                        
                        // make sure to add a null value
                        CGLPixelFormatAttribute[] attribs = new CGLPixelFormatAttribute[] { 
							CGLPixelFormatAttribute.Accelerated, 
							CGLPixelFormatAttribute.DoubleBuffer, CGLPixelFormatAttribute.ColorSize, (CGLPixelFormatAttribute)24, CGLPixelFormatAttribute.DepthSize, (CGLPixelFormatAttribute)16 };
                        
                        int numPixs = -1;
                        CGLPixelFormat pixelFormat = new CGLPixelFormat (attribs, out numPixs);
                        return pixelFormat;
                }