lid6j86's picture

integration into WPF

I saw a post was already made about this but for the life of me I can't understand what it's trying to say, it doesn't seem very clear to me:

how can I get a GLControl integrated with a WPF form? I've spent the past 2 hours messing around with xaml, windows form host, and trying to get it to correctly load.

On a side note: is a GameWindow program compatible with, say, Windows Store Applications? If this question doesnt make sense please let me know


Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
lid6j86's picture

as a side note the error i keep getting when i'm trying to follow these examples is this:

Could not load file or assembly 'OpenTK, Version=1.0.0.0, Culture=neutral, PublicKeyToken=bad199fe84eb3df4' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

not sure what it means

darkprinze's picture

It seems like you didnt add references in proper way. Install opentk in your system. Once OpenTK installed, you need to add following dll's as reference in your project.

1. OpenTK.dll
2. OpenTK.Compatibility
3. OpenTK.GLControl

Than, Call the reference in your xaml file.

        xmlns:WF="clr-namespace:System.Windows.Forms;assembly=System.Windows.Forms"
        xmlns:GL="clr-namespace:OpenTK;assembly=OpenTK.GLControl"

After, You need to put place your GLControl into WindowsFormsHost

<Border Margin="5,65,5,5" BorderBrush="Gray" BorderThickness="1">
            <WindowsFormsHost  x:Name="wfContainer" Background="Transparent">
                <GL:GLControl x:Name="glControl" Load="GLControl_Load" Resize="GLControl_Resize" Paint="GLControl_Paint" />
            </WindowsFormsHost>
        </Border>

Hope it helps.