OpenGL Windows form - 3D model background - winforms

I have C# windows form application. The form has a background image and few controls in it. In one area of the form, i want to render a 3D model. 3D model can be rotated, translated.
Now the problem is background of 3D model is black. Here, instead of black background, i need the background of openGL component to be transparent, such that form's background is visible. How do i achieve this?
Used SharpGL library for all openGL calls.

Related

WPF WindowsFormsHost creates fuzzy text

I am hosting a winforms DataGridView inside a WindowsFormsHost on a WPF Window. Functionality is fine, but the text in the grid cells looks a little more fuzzy. Normally WinForms text has very little antialiasing.
How can I get the DataGridView text to look as it normally would on a Windows Form, or at least be sharper? I have tried playing with the TextOptions.TextFormattingModeand SnapsToDevicePixelssettings of the WindowsFormsHost, but don't see any difference.
As an example of what I mean here are two screenshots:
Datagridview inside a WPF WindowsFormsHost:
DataGridView in Windows Forms:
The appearance of hosted WinForms/Win32 content should not be affected by WPF. There is an "airspace" limitation that dictates that a single window pixel can only be owned by a single graphics API, and it can only be drawn by that API. Hence, WinForms content is drawn by WinForms/GDI+, even when hosted by WPF. This explains why hosted content will be drawn on top of any WPF content in the same window, even if the WPF content is positioned in front of it.
Changing WPF rendering properties like TextFormattingMode cannot affect the appearance of interop content. You should be looking at the layout/rendering properties of the hosted WinForms content.
Update
Presumably the fuzzy effect is do to WPF defaulting to grayscale AA for the DataGridView. In the Paint and/or CellPainting events of the DataGridView, setting the graphics text hint to cleartype:
e.Graphics.TextRenderingHint = Drawing.Text.TextRenderingHint.ClearTypeGridFit
eliminated most of the fuzziness.

Paint program controls and components?

What components or 3d party controls exist for creating a paint or canvas based program similar to Photoshop or ArtRage for WinForms and WPF?
You'll want to use the Canvas control. There's an introduction to it here. You can customize the hell out of it using adorners and mouse events as well.

Rendering WPF controls on planes in 3D space

I have the following setup: I can track a surface very accuratly in a 3d space using a tracking system. Now I want to project on this plane with an overhead projector.
I want to develop my interface in WPF/XAML and then render it in real time to the surface that is tracked. But I don't know exactly how to do it...
This is what I think: I need to model the tracked surface in a 3D space, then I want to develop the interface using regular WPF/XAML controls use (maybe) directx to render these controls to model in 3D that represent the tracked surface.
I already found information of using directx in combination with wpf (Sharpdx.WPF) but here they demonstrate how to create 3d scenes with wpf... However, they don't show how to use regular WPF controls and render these to the 3d models.
Do I first need to convert the user control of WPF/XAML to an image and then render it to the 3d model or is there another way to do it?

What is the best way to display text, images and 2d wpf animation content?

What is the best way to display text, images and 2d wpf animation content in WPF? I am developing a desktop application which is supposed to display such content in an organized and easily navigable way But i don't know how to display the content. I have considered using Flow document for the text and image but it doesn't provide facilities for wpf animations. I can separate the text image part from the wpf animation but that might make management of resources harder. What is the proper way displaying such content?
PS I am using Expression Blend to design the user interface and to animate some resources and The application is an electronic magazine
I have not used this but FlowDocument has animation
FlowDocument.BeginAnimation Method

Where Is DrawingBrush In Windows Metro for XAML

Im writing a Windows Metro XAML based app in C#, and I want to draw grid lines with a brush on my custom grid control.
In WPF I would create a DrawingBrush to do the job, but there seems to be no equivalent in Metro ???
Does anyone know if this feature exists under another name, or that you achieve the same result differently ?
As an additional note, I do not want to draw lines etc directly on my grid (adding lines to my panel's children collection), It really needs to be done via the background property - i.e a brush.
Thanks
WinRT-XAML stack is closer to Silverlight - also in its limited graphics features when compared with Silverlight. The only TileBrush for WinRT apps is the ImageBrush, so you would need to save your drawing as an image first. You can't do that with the XAML stack either though - because there is no drawing class and WriteableBitmap has no Render() method. On the other hand - you can access DirectX for any more advanced features and combine some DirectX code with your XAML.

Resources