void Resize(int width, int height, IntPtr pixels, int bytesPerPixel) { fWidth = width; fHeight = height; fPixelLength = width * height * bytesPerPixel; fPixelPtr = pixels; // Free up the current buffer object if (null != fBufferObject) { fBufferObject.Dispose(); } fBufferObject = new PixelBufferObjectUnpacked(GI, BufferUsage.StreamDraw, fPixelLength); // Delete the current texture ID uint[] texid = { TextureID }; GI.DeleteTextures(1, texid); // Get a new texture ID TextureID = GLTexture.GetNewTextureID(); // Set our typical parameters GI.BindTexture(TextureBindTarget.Texture2d, TextureID); GI.TexParameter(TextureParameterTarget.Texture2d, TextureParameterName.TextureWrapS, TextureWrapMode.Clamp); GI.TexParameter(TextureParameterTarget.Texture2d, TextureParameterName.TextureWrapT, TextureWrapMode.Clamp); GI.TexParameter(TextureParameterTarget.Texture2d, TextureParameterName.TextureMinFilter, TextureMinFilter.Linear); GI.TexParameter(TextureParameterTarget.Texture2d, TextureParameterName.TextureMagFilter, TextureMagFilter.Linear); GI.TexEnv(TextureEnvModeParam.Decal); fNeedsResize = false; }
void SetupCaptureDevice(GraphicsInterface gi) { // Create the buffer object based on the video source sizes fBufferObject = new PixelBufferObjectUnpacked(gi, BufferUsage.StreamDraw, IntPtr.Zero, fVideoSource.Height * fVideoSource.Width * 3); // Set our typical parameters GI.BindTexture(TextureBindTarget.Texture2d, TextureID); SetupFiltering(); SetupWrapping(); // Register the function to receive notification when data is received fVideoSource.NewFrame += ReceivedNewFrame; }
void SetupCaptureDevice(GraphicsInterface gi) { // Create the buffer object based on the video source sizes fBufferObject = new PixelBufferObjectUnpacked(gi, BufferUsage.StreamDraw, fVideoSource.Height * fVideoSource.Width * 3); fBufferObject.Bind(); int buffSize = fBufferObject.Size; BufferUsage usage = fBufferObject.Usage; fBufferObject.Unbind(); // Set our typical parameters GI.BindTexture(TextureBindTarget.Texture2d, TextureID); GI.TexParameter(TextureParameterTarget.Texture2d, TextureParameterName.TextureWrapS, TextureWrapMode.Clamp); GI.TexParameter(TextureParameterTarget.Texture2d, TextureParameterName.TextureWrapT, TextureWrapMode.Clamp); GI.TexParameter(TextureParameterTarget.Texture2d, TextureParameterName.TextureMinFilter, TextureMinFilter.Linear); GI.TexParameter(TextureParameterTarget.Texture2d, TextureParameterName.TextureMagFilter, TextureMagFilter.Linear); // Register the function to receive notification when data is received fVideoSource.NewFrame += new CameraEventHandler(ReceivedNewFrame); Start(); }