GOoOGle's picture

Gtkglarea-sharp

Hi,

I'm trying to use glade and opentk, and since 2 nights i try just to make and run the examples of gtkglarea-sharp. I finally successfully did it by adding the the Tao.OpenGl into the GAC via the line :

$gacutil /i Tao.OpenGl.dll /f /package Tao.OpenGl /root /home/gooogle/install/mono-1.2.6/lib/

My stuff lead me to get 2 questions :

First question :
why can't I add OpenTK.dll into the gac ? the result of the gacutil command was :

$gacutil /i OpenTK.dll /f /package opentk-sharp /root /home/gooogle/install/mono-1.2.6/lib/
Failure adding assembly to the cache: Attempt to install an assembly without a strong name.
$gacutil /i OpenTK.dll /f /package OpenTK /root /home/gooogle/install/mono-1.2.6/lib/
Failure adding assembly to the cache: Attempt to install an assembly without a strong name.
$

Second question :
I try to use OpenTK instead of Tao for the examples of gtkglarea-sharp. So i did it successfully and i could compile the examples with OpenTK instead of Tao, by replacing all the gl.glFunction with GL.Function OpenTK calls.
But i did not work when i execute, with this error :

Exception in Gtk# callback delegate
  Note: Applications can use GLib.ExceptionManager.UnhandledException to handle the exception.
System.NullReferenceException: Object reference not set to an instance of an object
  at OpenTK.OpenGL.GL.Viewport (Int32 x, Int32 y, Int32 width, Int32 height) [0x00000] 
  at GtkGL.GLWidget.OnConfigure (System.Object o, System.EventArgs e) [0x0000c] in /home/gooogle/src/gtkglarea-sharp-opentk/examples/util/GLWidget.cs:184 
  at Gtk.Widget.ConfigureEventSignalCallback (IntPtr arg0, IntPtr arg1, IntPtr gch) [0x00000] 
   at GLib.ExceptionManager.RaiseUnhandledException(System.Exception e, Boolean is_terminal)
   at Gtk.Widget.ConfigureEventSignalCallback(IntPtr arg0, IntPtr arg1, IntPtr gch)
   at Gtk.Widget.ConfigureEventSignalCallback(IntPtr , IntPtr , IntPtr )
   at Gtk.Widget.gtk_widget_show(IntPtr )
   at Gtk.Widget.gtk_widget_show(IntPtr )
   at Gtk.Widget.Show()

Moreover, when i try to add the action GL.Viewport(0, 0, 20, 20); in a test program, i got exactly the same error above.
So question is : did the init of OpenTK is it different from tao ? and if yes, what could i have to add to have the right comportment ?
Because when i grep the gtkglarea code source, i only found Tao dependancies in the Examples folders, so i suppose the created dll for gtkglarea-sharp is good.
I precise when i added a test code with an GameWindow in the same test program, it's work perfectly, so i don't have problem with dependancies of OpenTK. I think i have my openGl context not initialize. But if it's true, how tao work, without it ?

Thanks for reading me,
sincerly,
GOoOGle


Comments

Comment viewing options

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

You need to call OpenTK.GL.LoadAll() or something like that to initialize OpenTK.GL.

GOoOGle's picture

Hello !
Thanks a lots ! It's perfectly works !
I just add the GL.LoadAll(); before the first call to the OpenTK methods and i also add a OpenTK.OpenGL.GLU.LoadAll() to have access to the famous teapot, and moreover the gluPerspective methods and i successfully port the gtkglarea-sharp from tao to openTK !
Now it just miss a usable stetic graphical component widget for monodevelop to have exactly the same comportement than with the windows.form component.
Thank again!

the Fiddler.'s picture

I haven't had time to add the GTK# OpenGL widget to OpenTK yet, but this will come at some point in the future. It's good to know that the Tao widget works with OpenTK though.