public GLSketchViewer(GraphicsInterface gi, int width, int height) { fDynamicTexture = new SnapNGLView.DynamicTexture(gi, width, height, 3); // Create the backing buffer to retain the image backingBuffer = new PixelBuffer24(width, height); //backingBuffer.DeviceContext.ClearToWhite(); // 1. Show a dialog box to allow the user to type in the // group IP address and port number. HostForm groupForm = new HostForm(); groupForm.ShowDialog(); // 2. Get the address and port from the form, and use // them to setup the MultiSession object string groupIP = groupForm.groupAddressField.Text; int groupPort = int.Parse(groupForm.groupPortField.Text); IPEndPoint ipep = new IPEndPoint(IPAddress.Parse(groupIP), groupPort); // Create the session fSession = new MultiSession(Guid.NewGuid().ToString(), ipep); // Add the channel for graphics commands fSketchChannel = fSession.CreateChannel(PayloadType.Whiteboard); // 3. Setup the chunk decoder so we can receive new images // when they come in fChunkDecoder = new GraphPortChunkDecoder(backingBuffer, fSketchChannel); fChunkDecoder.PixBltPixelBuffer24Handler += this.PixBltPixelBuffer24; fChunkDecoder.PixBltLumbHandler += this.PixBltLum24; //fSketchChannel.FrameReceivedEvent += FrameReceived; }
public Projector() : base("Snap N Projector", 20, 20, 640, 480) { HostForm groupForm = new HostForm(); groupForm.ShowDialog(); // Get the address and port from the form string groupIP = groupForm.groupAddressField.Text; int groupPort = int.Parse(groupForm.groupPortField.Text); IPEndPoint ipep = new IPEndPoint(IPAddress.Parse(groupIP), groupPort); fDrawingContext = GDIContext.CreateForDesktopBackground(); fDestinationRect = new Rectangle(0, 0, fDrawingContext.SizeInPixels.Width, fDrawingContext.SizeInPixels.Height); // Create the session fSession = new MultiSession(Guid.NewGuid().ToString(), ipep); fViewer = new SketchViewer(fSession, 1600, 1200); fViewer.DataChangedEvent += ReceiveImage; }