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; }
protected virtual void SetupTexture2D(GraphicsInterface gi, int width, int height, TextureInternalFormat internalFormat, TexturePixelFormat pixelFormat, PixelComponentType pixelType, IntPtr pixelData, bool createMipMaps) { fWidth = width; fHeight = height; fInternalFormat = internalFormat; fPixelFormat = pixelFormat; fPixelType = pixelType; // Setup the alignment fGI.PixelStore(PixelStore.UnpackAlignment, 1); // Allocate storage for the texture // We do this once at the beginning to allocate space for the texture object fGI.TexImage2D(0, internalFormat, fWidth, fHeight, 0, pixelFormat, pixelType, pixelData); // Setup default filters and wrapping SetupFiltering(); SetupWrapping(); if (createMipMaps) { // Make call to generate MipMap //fGI.GenerateMipmap(); // Alter the min filter to use the mipmap fGI.TexParameter(TextureParameterTarget.Texture2d, TextureParameterName.TextureMinFilter, TextureMinFilter.LinearMipmapLinear); } }
protected override void BeginRender(GraphicsInterface gi) { gi.Glu.QuadricNormals(Handle, (int)fNormalType); gi.Glu.QuadricDrawStyle(Handle, (int)fDrawingStyle); gi.Glu.QuadricOrientation(Handle, (int)fOrientation); gi.Glu.QuadricTexture(Handle, fUsesTexture); }
void DrawQuad(GraphicsInterface GI, float left, float top, float right, float bottom) { GI.PushMatrix(); GI.Rotate(Rotation); GI.Drawing.Quads.Begin(); // Left bottom GI.TexCoord(0.0f, 0.0f); GI.Vertex(left, bottom, 0.0f); // Left top GI.TexCoord(0.0f, 1.0f); GI.Vertex(left, top, 0.0f); // Right top GI.TexCoord(1.0f, 1.0f); GI.Vertex(right, top, 0.0f); // Right bottom GI.TexCoord(1.0f, 0.0f); GI.Vertex(right, bottom, 0.0f); GI.Drawing.Quads.End(); GI.PopMatrix(); }
public ConferenceRoom(GraphicsInterface gi, Vector3D roomSize) : base(gi, roomSize, new Vector3D(0, roomSize.Y / 2.0f, 0), new Resolution(10, 10)) { fWallTexture = TextureHelper.CreateTextureFromFile(gi, "Textures\\Wall.tiff", false); fCeilingTexture = TextureHelper.CreateTextureFromFile(gi, "Textures\\Ceiling.tiff", false); fFloorTexture = TextureHelper.CreateTextureFromFile(gi, "Textures\\Carpet_berber_dirt.jpg", false); fChildren = new List<IRenderable>(); SetWallTexture(AABBFace.Ceiling, fCeilingTexture); SetWallTexture(AABBFace.Floor, fFloorTexture); SetWallTexture(AABBFace.Front, fWallTexture); SetWallTexture(AABBFace.Back, fWallTexture); SetWallTexture(AABBFace.Left, fWallTexture); SetWallTexture(AABBFace.Right, fWallTexture); Vector3D wbSize = new Vector3D(4.0f-(0.305f*2.0f), 3.0f, 0.01f); Point3D wbTrans = new Point3D(0, (wbSize.Y/2)+(roomSize.Y-wbSize.Y)/2, -roomSize.Z / 2.0f+.02f); AABB wbBB = new AABB(wbSize, wbTrans); whiteboard = new Whiteboard(gi, wbBB); //whiteboard.ImageSource = localCamProjector; fTable = new PedestalTable(gi); fChildren.Add(whiteboard); fChildren.Add(fTable); }
public GLUSphere(GraphicsInterface gi, double radius, int slices, int stacks) :base(gi, QuadricDrawStyle.Fill, QuadricNormalType.Smooth, QuadricOrientation.Outside) { fRadius = radius; fSlices = slices; fStacks = stacks; }
public bool CreateContext(IntPtr windowHandle, int colorBits, int depthBits, int stencilBits) { fGLContext = new GLContext(windowHandle, colorBits, depthBits, PFDFlags.DoubleBuffer); fGI = new GraphicsInterface(fGLContext); return (null != fGLContext); }
protected override void BeginRender(GraphicsInterface gi) { if (fUseColors && (null != Colors)) { gi.ClientFeatures.ColorArray.Enable(); gi.ColorPointer(Colors); } //if (fUseEdges && (null != Edges)) // gi.EnableClientState(ClientArrayType.EdgeFlagArray); if (fUseIndices && (null != Indices)) { gi.ClientFeatures.IndexArray.Enable(); gi.IndexPointer(IndexPointerType.Int, 0, Indices); } if (fUseNormals && (null != Normals)) { gi.ClientFeatures.NormalArray.Enable(); gi.NormalPointer(Normals); } if (fUseTexture && (null != TexCoords)) { gi.ClientFeatures.TextureCoordArray.Enable(); gi.TexCoordPointer(TexCoords); } if (fUseVertices && (null != Vertices)) { gi.ClientFeatures.VertexArray.Enable(); gi.VertexPointer(Vertices); } }
protected override void RenderContent(GraphicsInterface gi) { int p1, p2, p3; for (int i = 0; i < triangles.Length; i++) { p1 = triangles[i].p1; p2 = triangles[i].p2; p3 = triangles[i].p3; gi.Color(1, 1, 1, 0.95f); gi.Drawing.Triangles.Begin(); gi.Normal(normals[p1]); gi.TexCoord(uvMap[p1, 0], uvMap[p1, 1]); gi.Vertex(positions[p1]); gi.Normal(normals[p2]); gi.TexCoord(uvMap[p2, 0], uvMap[p2, 1]); gi.Vertex(positions[p2]); gi.Normal(normals[p3]); gi.TexCoord(uvMap[p3, 0], uvMap[p3, 1]); gi.Vertex(positions[p3]); gi.Drawing.Triangles.End(); } }
public DCTProcessor(GraphicsInterface gi, int width, int height) { fGI = gi; fWidth = width; fHeight = height; // Create the cosine buffer // Calculate the cosines // assign the values to the texture object fCosineBuffer = new GLTextureRectangle(gi, 8, 8, TextureInternalFormat.Luminance, TexturePixelFormat.Luminance, PixelType.Float); fRenderTarget = new GLRenderTarget(gi, width, height); fDCTOutputTexture = new GLTextureRectangle(gi, width, height, TextureInternalFormat.Rgba, TexturePixelFormat.Rgba, PixelType.Float); // We attach the texture 4 times so we can output to the same texture four times // in one shader pass using gl_FragData[0,1,2,3] fRenderTarget.AttachColorBuffer(fDCTOutputTexture, ColorBufferAttachPoint.Position0); fRenderTarget.AttachColorBuffer(fDCTOutputTexture, ColorBufferAttachPoint.Position1); fRenderTarget.AttachColorBuffer(fDCTOutputTexture, ColorBufferAttachPoint.Position2); fRenderTarget.AttachColorBuffer(fDCTOutputTexture, ColorBufferAttachPoint.Position3); fRenderTarget.Unbind(); // Precalculate the basis functions (cosine tables) }
public BrickShader(GraphicsInterface gi) : base(gi) { //Console.WriteLine("BrickShader Link Log: \n{0}", InfoLog); GLSLVertexShader vShader = new GLSLVertexShader(gi, Brick_VertexSource); AttachShader(vShader); GLSLFragmentShader fShader = new GLSLFragmentShader(gi, Brick_FragmentSource); AttachShader(fShader); Link(); // Do an initial selection so that all the variables can be located Bind(); BrickColor_Pos = GetUniformLocation("BrickColor"); MortarColor_Pos = GetUniformLocation("MortarColor"); BrickSize_Pos = GetUniformLocation("BrickSize"); BrickPct_Pos = GetUniformLocation("BrickPct"); // From the Vertex Shader LightPosition_Pos = GetUniformLocation("LightPosition"); // Set some initial values BrickColor = new ColorRGBA(1.0f, 0.3f, 0.2f); MortarColor = new ColorRGBA(0.85f, 0.86f, 0.84f); BrickSize = new float2(0.30f, 0.15f); BrickPct = new float2(0.90f, 0.85f); LightPosition = new Vector3f(0.0f, 0.0f, 4.0f); // Unselect so we start in an unselected state Unbind(); }
public GLRenderBuffer(GraphicsInterface gi, int width, int height, int format) : this(gi) { Bind(); GI.RenderbufferStorage(gl.GL_RENDERBUFFER_EXT, format, width, height); Unbind(); }
//public Mesh3D(BeginMode mode) // :this(null, mode) //{ //} public Mesh3D(GraphicsInterface gi, BeginMode mode) { GI = gi; fDrawingPrimitive = mode; fUseVertices = true; fUseIndices = true; }
/// <summary> /// This override is called by whomever is controlling the rendering process. /// We call the base Render method as it will automatically use the /// vertices, indices, and texture coordinates to draw the quads. /// </summary> /// <param name="GI"></param> public override void Render(GraphicsInterface GI) { if (fUseTexture) GI.Features.Texturing2D.Enable(); base.Render(GI); }
protected override void RenderContent(GraphicsInterface GI) { // Draw Section 0 GI.PushMatrix(); GI.Rotate(0, 0, 1, 0); GI.Translate(0, 4, fSpeakerSection0.Radius * fSpeakerSeparation); fSpeakerSection0.Render(GI); GI.PopMatrix(); // Draw Section 90 GI.PushMatrix(); GI.Rotate(90, 0, 1, 0); GI.Translate(0, 4, fSpeakerSection90.Radius * fSpeakerSeparation); fSpeakerSection90.Render(GI); GI.PopMatrix(); // Draw Section 180 GI.PushMatrix(); GI.Rotate(180, 0, 1, 0); GI.Translate(0, 4, fSpeakerSection180.Radius * fSpeakerSeparation); fSpeakerSection180.Render(GI); GI.PopMatrix(); // Draw Section 270 GI.PushMatrix(); GI.Rotate(270, 0, 1, 0); GI.Translate(0, 4, fSpeakerSection270.Radius * fSpeakerSeparation); fSpeakerSection270.Render(GI); GI.PopMatrix(); }
public GLBufferList(GraphicsInterface gi) { fColorBuffer = new GLColorBuffer(gi); fDepthBuffer = new GLDepthBuffer(gi); fStencilBuffer = new GLStencilBuffer(gi); fAccumBuffer = new GLAccumBuffer(gi); }
/// <summary> /// This constructor is used when you're trying to put a wrapper around /// an already existing shader object. You have the context, and you have /// the shaderID. This is enough information to do useful things with /// the shader. /// </summary> /// <param name="gi"></param> /// <param name="shaderID"></param> public GLSLShader(GLSLShaderProgram prg, int shaderID) { fShaderID = shaderID; fProgram = prg; if (null != prg) fGI = prg.GI; }
protected override void BeginRender(GraphicsInterface GI) { GI.Features.Texturing2D.Enable(); GI.TexEnv(TextureEnvModeParam.Decal); GI.FrontFace(FrontFaceDirection.Cw); GI.PolygonMode(GLFace.Front, PolygonMode.Fill); }
public Cube(GraphicsInterface gi, Vector3D size, GLTexture texture) :base(gi, BeginMode.Quads) { fSize = size; Texture = texture; CreateMesh(); }
public GLUCone(GraphicsInterface gi, double baseSize, double height, int slices, int stacks) : base(gi, QuadricDrawStyle.Fill, QuadricNormalType.Smooth, QuadricOrientation.Outside) { fBase = baseSize; fHeight = height; fSlices = slices; fStacks = stacks; }
public static int GetNewID(GraphicsInterface gi) { int[] IDs = new int[1]; gi.GenRenderbuffers(1, IDs); return IDs[0]; }
public Camera(GraphicsInterface gi, Point3D location, Point3D lookAt, Vector3D up) { GI = gi; fPosition = location; fLookAt = lookAt; fUp = up; }
public GLProjectionCamera(GraphicsInterface gi, Point3D location, Point3D lookAt, Vector3D up, float nearPlane, float farPlane) :base(gi, location, lookAt, up) { fFrustum = new GLFrustum(-1, 1, 1, -1, -1, 1); fNearPlaneDistance = nearPlane; fFarPlaneDistance = farPlane; }
public GLUDisk(GraphicsInterface gi, double innerradius, double outerradius, int slices, int loops) :base(gi, QuadricDrawStyle.Fill, QuadricNormalType.Smooth, QuadricOrientation.Outside) { fInnerRadius = innerradius; fOuterRadius = outerradius; fSlices = slices; fLoops = loops; }
public GLRenderTarget(GraphicsInterface gi) { fGI = gi; fColorBuffers = new Dictionary<ColorBufferAttachPoint, GLTexture2D>(); fFrameBuffer = new GLFrameBufferObject(fGI); }
public GLExtensions(GraphicsInterface gi) { fInfoStrings = new GLInfoStrings(gi); fExtensions = new Hashtable(); foreach (string s in fInfoStrings.ExtensionList) fExtensions.Add(s, true); }
public VideoTexture(GraphicsInterface gi, VideoCaptureDevice vidSource, bool autoStart) :base(gi, TextureBindTarget.Texture2d) { fVideoSource = vidSource; SetupCaptureDevice(gi); if (autoStart) Start(); }
protected override void RenderContent(GraphicsInterface gi) { gi.Normal(0, 0, 1); gi.Begin(BeginMode.Lines); gi.Vertex(fxbase, fybase - 5, fzbase); gi.Vertex(fxbase, fybase + fHeight * fSize + 0.5f, fzbase); gi.End(); }
//PixelBufferObjectUnpacked fBufferObject; #endregion #region Constructor public DynamicTexture(GraphicsInterface gi, int width, int height, int bytesPerPixel) : base(gi, width, height) { lastBound = 0; latestFrame = 0; newPixels = IntPtr.Zero; Resize(width, height, newPixels, bytesPerPixel); }
protected override void EndRender(GraphicsInterface gi) { switch(fDrawingStyle) { case TorusDrawStyle.WireFrame: gi.PopAttrib(); break; } }