WPF Project has wrong version of OpenGL

507 views Asked by At

I have two separate WPF projects. My goal: Alter project B to have the same OpenGL object instance version as project A.

Both instantiate a variable 'gl' at some point with the following line:

OpenGL gl = args.OpenGL;

After setting a breakpoint and check 'gl' for its object properties, I see the following in project A:

Version = "4.4.13084 Compatibility Profile Context 14.301.1001.0"

Yet in project B, I see the following:

Version = "1.1.0"

Concerning 'args' both projects instantiate gl in the following method:

private void OpenGLControl_OpenGLInitialized(object sender, OpenGLEventArgs args)

Both projects call that method with:

((SharpGL.WPF.OpenGLControl)(target)).OpenGLInitialized += new SharpGL.SceneGraph.OpenGLEventHandler(this.OpenGLControl_OpenGLInitialized);

Notice that 'args' is not being passed in from here explicitly. I figured function must be called in a deeper context like OpenGLEventHandler. However, I noticed that args is a parameter to that function as well.

public delegate void OpenGLEventHandler(object sender, OpenGLEventArgs args);

I don't have access to source code for OpenGLEventHandler since it is in SceneGraph.dll

I am wondering if the args variable is determined by a .config or .xaml file since my project is a WPF being run from Visual Studio. However, there isn't much differences in the files concerning OpenGL.

Project A's MainWindow.xaml:

<Window x:Class="ObjectLoadingSample.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="Object LoadingSample" Height="600" Width="800"
        xmlns:sharpGL="clr-namespace:SharpGL.WPF;assembly=SharpGL.WPF">
    <Grid>
        <DockPanel>

            <ToolBarPanel DockPanel.Dock="Top">
                <Menu>
                    <MenuItem Header="_File">
                        <MenuItem x:Name="fileOpenItem" Header="_Open..." Click="fileOpenItem_Click" />
                    </MenuItem>
                </Menu>
            </ToolBarPanel>

            <ToolBarTray DockPanel.Dock="Top">
                <ToolBar>
                    <Label Target="{Binding ElementName=textBoxScale}">Scale: </Label>
                    <TextBox x:Name="textBoxScale" Width="60" IsEnabled="False">1</TextBox>
                    <CheckBox x:Name="checkBoxAutoScale" IsChecked="True" IsEnabled="False">Auto</CheckBox>
                    <Separator />
                    <Label Target="{Binding ElementName=comboBoxRenderMode}">Render Mode: </Label>
                    <ComboBox x:Name="comboBoxRenderMode" Width="100" SelectedIndex="1">
                        <ComboBoxItem>Immediate</ComboBoxItem>
                        <ComboBoxItem>Retained</ComboBoxItem>
                    </ComboBox>
                    <Label Target="{Binding ElementName=comboBoxPolygonMode}">Polygon Mode:</Label>
                    <ComboBox x:Name="comboBoxPolygonMode" Width="100" SelectedIndex="2" SelectionChanged="comboBoxPolygonMode_SelectionChanged">
                        <ComboBoxItem>Points</ComboBoxItem>
                        <ComboBoxItem>Lines</ComboBoxItem>
                        <ComboBoxItem>Polygons</ComboBoxItem>
                    </ComboBox>
                </ToolBar>
            </ToolBarTray>

            <sharpGL:OpenGLControl x:Name="openGlCtrl"
            OpenGLDraw="OpenGLControl_OpenGLDraw" OpenGLInitialized="OpenGLControl_OpenGLInitialized" 
            RenderContextType="FBO" Resized="OpenGLControl_Resized" />
        </DockPanel>
    </Grid>
</Window>

Project B's MainWindow.xaml

<Window x:Class="ProjectBeta.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:sharpGL="clr-namespace:SharpGL.WPF;assembly=SharpGL.WPF"
        Title="MainWindow" Height="800" Width="800">
  <Grid>
    <sharpGL:OpenGLControl OpenGLDraw="OpenGLControl_OpenGLDraw" OpenGLVersion="OpenGL4_3"  OpenGLInitialized="OpenGLControl_OpenGLInitialized" DrawFPS="True" Margin="-3,0,3,0" />
  </Grid>
</Window>

There are other files like App.config, App.xaml, and Settings.settings, however, I don't know which ones would be most useful to share.

0

There are 0 answers