This project is read-only.

WPF window sometimes not showing up

Feb 6, 2013 at 6:29 PM
Edited Feb 6, 2013 at 6:29 PM
Hi!

I have created my first WPF app with SharpGL. SharpGL is by itself really great, but i have one problem:
When I start my application in debug mode in VS, the main window is sometimes not showing up. I know that the app is running because I can click on the "stop debugging" button.
When this happens, the OpenGLDraw-method is also not executed.
Feb 7, 2013 at 9:10 PM
That's very strange - so this is only happening intermittently?

Can you tell me, is this happening occasionally during the same session using visual studio, or does it happen again and again until visual studio has started? Also, have you got any drawing/projection/ui code or is the application essentially vanilla?

Cheers!

Dave
Feb 8, 2013 at 5:47 PM
Edited Feb 8, 2013 at 5:48 PM
I think I know the reason: In my application I added a menu bar at the top of the window. When I remove this menu bar, the app runs fine. When I add the menu bar then the above stated problem occurs. My xaml-code:
<Window x:Class="WpfApplication1.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="350" Width="525"
        xmlns:sharpGL="clr-namespace:SharpGL.WPF;assembly=SharpGL.WPF">
    
    <Grid>
        <Menu IsMainMenu="True">
            <MenuItem Header="_File">
                <MenuItem Header="_Open..." IsCheckable="true" Click="OpenFile_CLick"/>
            </MenuItem>
        </Menu>
        <sharpGL:OpenGLControl OpenGLDraw="OpenGLControl_OpenGLDraw"
                               OpenGLInitialized="OpenGLControl_OpenGLInitialized" 
                               RenderContextType="FBO" 
                               Resized="OpenGLControl_Resized" 
                               Margin="0,21,0,0"/>
    </Grid>
</Window>
dwmkerr wrote:
Can you tell me, is this happening occasionally during the same session using visual studio, or does it happen again and again until visual studio has started?
It happens during the same session. The application has nothing special in it, only this menu bar extends it.
Feb 10, 2013 at 12:09 PM
Thanks for the update - just put the menu and the OpenGLCtrl in a DockPanel - Dock the menu on the top, then all should work well :)
Feb 15, 2013 at 1:28 PM
I did what you say. Unfortunately that didn't help. :(
Feb 25, 2013 at 7:51 PM
I took some other dlls and it seems to work now.
Feb 25, 2013 at 10:23 PM
Great - were they other Apex dlls, i.e. later versions, .NET framework dlls or third party? I just want to know if it's an Apex issue cause if so I'll raise a bug for it, otherwise, I'll just leave the discussion up in case others see a similar problem.
Feb 26, 2013 at 12:36 PM
Edited Feb 26, 2013 at 12:57 PM
Yesterday I recognized that my WPF/SharpGL application was consuming more than 1Gb or RAM. Moreover the framerate was really poor and the app sometimes didn't start up as described above.
I used those three dlls. (But I'm not sure where I got them)
SharpGL.dll
SharpGL.WinForms.dll
SharpGL.WPF.dll

So I decided to find the cause of those problems. What resolved all this problems was to use those three files instead of the files I listed above:
..\Core\SharpGL\bin\Debug\SharpGL.dll
..\Core\SharpGL.SceneGraph\bin\Debug\SharpGL.SceneGraph and
..\Core\SharpGL.WPF\bin\Debug\SharpGL.WPF.dll

If you wanna have these "maybe buggy" files then contact me. I will send you them.

I didn't use any Apex dlls. I also didn't use any other special dlls.