Ctank02's picture

[solved]Windows Form Applications and OpenGL Control

Hello,

I am relatively new to OpenTK (been tinkering for about 2 hours now). I stumbled across this: http://www.opentk.com/doc/chapter/2/glcontrol?page=2 and decided to try it out.

The demo is not working. In fact, it appears that the windows form is not receiving OpenGL events/commands/[insert proper name].

Here is the setup I have:
Visual Studios 2010 (Professional)
Added References:
OpenTK
OpenTK.GL.Control

I have added the GLControl to my form (found in the toolbox).

I attached a png of my output.

Thanks for any help that can be provided.

P.S. if I missed this in my search, apologies.

Inline Images
Improper output

Comments

Comment viewing options

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

As a sanity check, try running OpenTK Example Browser -> OpenTK samples -> GLControl simple. Does it work? (It should display a red window and three buttons that change its color).

Ctank02's picture

Actually...It does not appear to work. Now, I think I may foresee your next question. I have run OpenGL with Python/Pyglet for quite sometime now, so I believe I have the required OpenGL drivers.

the Fiddler's picture

Right, thanks. In this case we'll need some debugging information.

Open OpenTK.sln with Visual Studio, make sure the configuration is set to Debug and hit compile. Now run the OpenTK.Examples project -> GLControl Simple and post the text from the "Application Output" panel in Visual Studio (View -> Output or Ctrl-W, O).

This should give a hint about the issue.

Ctank02's picture

Hmm, the results were less than exciting. From what I can tell, the default color of the windows in your examples is 'skyblue'. That is all I see, the default color of the output/source code tabs. This is true for every example (mind you, I randomly clicked multiple ones from each section, not all of them).

Corrupt download? Does OpenTK have a special driver I missed?

the Fiddler's picture
Ctank02 wrote:

Hmm, the results were less than exciting. From what I can tell, the default color of the windows in your examples is 'skyblue'. That is all I see, the default color of the output/source code tabs. This is true for every example (mind you, I randomly clicked multiple ones from each section, not all of them).

Corrupt download? Does OpenTK have a special driver I missed?

Most examples use a blue color for the background, but "GLControl Simple" should look similar to this:

What video card are you using? Do the examples actually work?

Ctank02's picture

GeForce Go 7900 GS (Laptop). No, none of the examples are working. That was the point I was trying to make earlier. AL, Cl, GL, doesn't matter, I couldn't get them to show output.

EDIT: Reinstall didn't fix the problems....

the Fiddler's picture

Alright, in that case the only way to diagnose the issue is to compile a debug version of OpenTK, run an example (Simple GameWindow, preferably) and post the results from the "Application Output" window here.

I'm also using Nvidia cards (6800 Go and 9500GT) and OpenTK works here, so this might be an unfortunate incompatibility with your specific drivers/OS/hardware you. Using the debug information, I might be able to find the cause and fix the problem.

Ctank02's picture
the Fiddler wrote:

Alright, in that case the only way to diagnose the issue is to compile a debug version of OpenTK, run an example (Simple GameWindow, preferably) and post the results from the "Application Output" window here.

I'm also using Nvidia cards (6800 Go and 9500GT) and OpenTK works here, so this might be an unfortunate incompatibility with your specific drivers/OS/hardware you. Using the debug information, I might be able to find the cause and fix the problem.

Output from Debug Console:

'Examples.vshost.exe' (Managed (v2.0.50727)): Loaded 'C:\Windows\assembly\GAC_32\mscorlib\2.0.0.0__b77a5c561934e089\mscorlib.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'Examples.vshost.exe' (Managed (v2.0.50727)): Loaded 'C:\Windows\assembly\GAC_MSIL\Microsoft.VisualStudio.HostingProcess.Utilities\10.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.HostingProcess.Utilities.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'Examples.vshost.exe' (Managed (v2.0.50727)): Loaded 'C:\Windows\assembly\GAC_MSIL\System.Windows.Forms\2.0.0.0__b77a5c561934e089\System.Windows.Forms.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'Examples.vshost.exe' (Managed (v2.0.50727)): Loaded 'C:\Windows\assembly\GAC_MSIL\System\2.0.0.0__b77a5c561934e089\System.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'Examples.vshost.exe' (Managed (v2.0.50727)): Loaded 'C:\Windows\assembly\GAC_MSIL\System.Drawing\2.0.0.0__b03f5f7f11d50a3a\System.Drawing.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'Examples.vshost.exe' (Managed (v2.0.50727)): Loaded 'C:\Windows\assembly\GAC_MSIL\Microsoft.VisualStudio.HostingProcess.Utilities.Sync\10.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.HostingProcess.Utilities.Sync.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'Examples.vshost.exe' (Managed (v2.0.50727)): Loaded 'C:\Windows\assembly\GAC_MSIL\Microsoft.VisualStudio.Debugger.Runtime\10.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.Debugger.Runtime.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'Examples.vshost.exe' (Managed (v2.0.50727)): Loaded 'C:\Users\ctank02\Documents\OpenTK\1.0\Binaries\OpenTK\Debug\Examples.vshost.exe', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'Examples.vshost.exe' (Managed (v2.0.50727)): Loaded 'C:\Windows\assembly\GAC_32\System.Data\2.0.0.0__b77a5c561934e089\System.Data.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'Examples.vshost.exe' (Managed (v2.0.50727)): Loaded 'C:\Windows\assembly\GAC_MSIL\System.Xml\2.0.0.0__b77a5c561934e089\System.Xml.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
The thread 'vshost.NotifyLoad' (0x1280) has exited with code 0 (0x0).
The thread 'vshost.LoadReference' (0x127c) has exited with code 0 (0x0).
'Examples.vshost.exe' (Managed (v2.0.50727)): Loaded 'C:\Users\ctank02\Documents\OpenTK\1.0\Binaries\OpenTK\Debug\Examples.exe', Symbols loaded.
'Examples.vshost.exe' (Managed (v2.0.50727)): Loaded 'C:\Windows\assembly\GAC_MSIL\System.Configuration\2.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'Examples.vshost.exe' (Managed (v2.0.50727)): Loaded 'C:\Users\ctank02\Documents\OpenTK\1.0\Binaries\OpenTK\Debug\OpenTK.dll', Symbols loaded.
'Examples.vshost.exe' (Managed (v2.0.50727)): Loaded 'C:\Users\ctank02\Documents\OpenTK\1.0\Binaries\OpenTK\Debug\OpenTK.GLControl.dll', Symbols loaded.

I wasn't sure if you wanted me to try and extract that demo out of the example project and run it by its self, so I did not (looked like it might have had some dependencies with other files - the utilities dependency was the one I got stuck on).

the Fiddler's picture

No need to extract the sample, running it directly is fine.

Does the output stop at that point? That's strange, here is how it looks on my system (the interesting part comes right after your post ends):

'Examples.vshost.exe' (Managed (v2.0.50727)): Loaded 'C:\WINDOWS\assembly\GAC_32\mscorlib\2.0.0.0__b77a5c561934e089\mscorlib.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'Examples.vshost.exe' (Managed (v2.0.50727)): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\Microsoft.VisualStudio.HostingProcess.Utilities\10.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.HostingProcess.Utilities.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'Examples.vshost.exe' (Managed (v2.0.50727)): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\System.Windows.Forms\2.0.0.0__b77a5c561934e089\System.Windows.Forms.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'Examples.vshost.exe' (Managed (v2.0.50727)): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\System\2.0.0.0__b77a5c561934e089\System.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'Examples.vshost.exe' (Managed (v2.0.50727)): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\System.Drawing\2.0.0.0__b03f5f7f11d50a3a\System.Drawing.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'Examples.vshost.exe' (Managed (v2.0.50727)): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\Microsoft.VisualStudio.HostingProcess.Utilities.Sync\10.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.HostingProcess.Utilities.Sync.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'Examples.vshost.exe' (Managed (v2.0.50727)): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\Microsoft.VisualStudio.Debugger.Runtime\10.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.Debugger.Runtime.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'Examples.vshost.exe' (Managed (v2.0.50727)): Loaded 'X:\demo\opentk\Binaries\OpenTK\Debug\Examples.vshost.exe', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'Examples.vshost.exe' (Managed (v2.0.50727)): Loaded 'C:\WINDOWS\assembly\GAC_32\System.Data\2.0.0.0__b77a5c561934e089\System.Data.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'Examples.vshost.exe' (Managed (v2.0.50727)): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\System.Xml\2.0.0.0__b77a5c561934e089\System.Xml.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
The thread 'vshost.LoadReference' (0x188) has exited with code 0 (0x0).
'Examples.vshost.exe' (Managed (v2.0.50727)): Loaded 'X:\demo\opentk\Binaries\OpenTK\Debug\Examples.exe', Symbols loaded.
'Examples.vshost.exe' (Managed (v2.0.50727)): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\System.Configuration\2.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'Examples.vshost.exe' (Managed (v2.0.50727)): Loaded 'X:\demo\opentk\Binaries\OpenTK\Debug\OpenTK.dll', Symbols loaded.
'Examples.vshost.exe' (Managed (v2.0.50727)): Loaded 'X:\demo\opentk\Binaries\OpenTK\Debug\OpenTK.GLControl.dll', Symbols loaded.
Launching sample: "GLControl Simple"
 
'Examples.vshost.exe' (Managed (v2.0.50727)): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\Accessibility\2.0.0.0__b03f5f7f11d50a3a\Accessibility.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
A first chance exception of type 'System.DllNotFoundException' occurred in OpenTK.dll
A first chance exception of type 'System.TypeInitializationException' occurred in OpenTK.dll
Detected configuration: Windows / .Net
A first chance exception of type 'System.DllNotFoundException' occurred in OpenTK.dll
DisplayDevice 1 (primary) supports 15 resolutions.
Creating default GraphicsMode (32, 16, 0, 0, 0, 2, False).
Creating GraphicsContext.
    GraphicsMode: Index: 2, Color: 0 (0000), Depth: 0, Stencil: 0, Samples: 0, Accum: 0 (0000), Buffers: 2, Stereo: False
    IWindowInfo: Windows.WindowInfo: Handle 394066, Parent (Windows.WindowInfo: Handle 656290, Parent (null))
    GraphicsContextFlags: Default
    Requested version: 1.0
    Loaded opengl32.dll: 1590689792
    OpenGL will be bound to window:394066 on thread:10
    Setting pixel format... 2
    Creating temporary context for wgl extensions.
    Load extensions for OpenTK.Platform.Windows.Wgl... 33 extensions loaded in 67 ms.
    Falling back to GL2... success! (id: 131072)
Retrieving ARB pixel formats.... Disposing context 131072.
Destroying window: Windows.WindowInfo: Handle 656290, Parent (null)
Creating GraphicsContext.
    GraphicsMode: Index: 1, Color: 32 (8888), Depth: 32, Stencil: 8, Samples: 1, Accum: 0 (0000), Buffers: 2, Stereo: True
    IWindowInfo: Windows.WindowInfo: Handle 263162, Parent (null)
    GraphicsContextFlags: Default
    Requested version: 1.0
    OpenGL will be bound to window:263162 on thread:10
    Setting pixel format... 1
    Falling back to GL2... success! (id: 196608)
Load extensions for OpenTK.Platform.Windows.Wgl... 33 extensions loaded in 32 ms.
Loading extensions for OpenTK.Graphics.OpenGL.GL... 2269 extensions loaded in 861.0555 ms.
Disposing context 196608.
The thread 'vshost.RunParkingWindow' (0xc20) has exited with code 0 (0x0).
The thread '<No Name>' (0x924) has exited with code 0 (0x0).
The program '[560] Examples.vshost.exe: Program Trace' has exited with code 0 (0x0).
The program '[560] Examples.vshost.exe: Managed (v2.0.50727)' has exited with code 0 (0x0).
Ctank02's picture

Does the framework have a debug option? AKA a flag somewhere in the files that needs to be set for me to see that?

Here is what I did:

I ran 'Build' on the entire OpenTK.sln

I then right click the OpenTKExamples and choose debug (Start a new instance).

I then navigate to the GameWindow simple and nothing shows up. All of the output I pasted actually shows up before I navigate there.