
Type Initialization Exception in the class Glu when trying to use the tessellator
Posted Friday, 18 December, 2009 - 18:41 by Carlos| Project: | The Open Toolkit library |
| Version: | 1.0-beta-2 |
| Component: | Code |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Jump to:
I get the following exception when the line
tess = Glu.NewTess();
is executed (sorry my system is in Spanish):
"Se produjo una excepción en el inicializador de tipo de 'OpenTK.Graphics.Glu'."
I'm working with WinXP/VS2008. The same code works OK when I use the 0.9.1 version.
Details/StackTrace:
System.TypeInitializationException was unhandled
Message="Se produjo una excepción en el inicializador de tipo de 'OpenTK.Graphics.Glu'."
Source="OpenTK.Compatibility"
TypeName="OpenTK.Graphics.Glu"
StackTrace:
en OpenTK.Graphics.Glu.NewTess()
en OpenTk_test.J3DTriangulate.Triangulate(Vector2[] Input, Int32[] VertsPerContour) en C:\Documents and Settings\Carlos\Mis documentos\Visual Studio 2008\Projects\OpenTk_test\OpenTk_test\GluTessellation.cs:línea 73
en OpenTk_test.Form1..ctor() en C:\Documents and Settings\Carlos\Mis documentos\Visual Studio 2008\Projects\OpenTk_test\OpenTk_test\Form1.cs:línea 30
en OpenTk_test.Program.Main() en C:\Documents and Settings\Carlos\Mis documentos\Visual Studio 2008\Projects\OpenTk_test\OpenTk_test\Program.cs:línea 18
en System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
en System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
en Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
en System.Threading.ThreadHelper.ThreadStart_Context(Object state)
en System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
en System.Threading.ThreadHelper.ThreadStart()
InnerException: System.TypeInitializationException
Message="Se produjo una excepción en el inicializador de tipo de 'OpenTK.Graphics.GL'."
Source="OpenTK.Compatibility"
TypeName="OpenTK.Graphics.GL"
StackTrace:
en OpenTK.Graphics.GL.GetExtensionDelegate(String name, Type signature)
en OpenTK.Graphics.Glu.LoadDelegate(String name, Type signature) en C:\Users\Athina\Desktop\opentk\opentk-1.0-beta-2\Source\Compatibility\Graphics\Glu\GluHelper.cs:línea 53
en OpenTK.Graphics.Glu.LoadAll() en C:\Users\Athina\Desktop\opentk\opentk-1.0-beta-2\Source\Compatibility\Graphics\Glu\GluHelper.cs:línea 84
en OpenTK.Graphics.Glu..cctor() en C:\Users\Athina\Desktop\opentk\opentk-1.0-beta-2\Source\Compatibility\Graphics\Glu\GluHelper.cs:línea 36
InnerException: System.InvalidOperationException
Message="No GraphicsContext available in the calling thread."
Source="OpenTK.Compatibility"
StackTrace:
en OpenTK.Graphics.GL.LoadAll() en C:\Users\Athina\Desktop\opentk\opentk-1.0-beta-2\Source\Compatibility\Graphics\GL\GLHelper.cs:línea 199
en OpenTK.Graphics.GL..cctor() en C:\Users\Athina\Desktop\opentk\opentk-1.0-beta-2\Source\Compatibility\Graphics\GL\GLHelper.cs:línea 83
InnerException:


Comments
#1
Thanks for the stack trace, investigating.
#2
I cannot reproduce this issue here. Can you please provide a simple test case that reproduces the problem?
These lines indicate that you might be calling OpenGL methods before creating an OpenGL context (e.g. via a GameWindow or a GLControl):
#3
I am closing this issue due to lack of response but feel free to reopen if the problem persists!
#4
I am experience the exact same bug as above...
Visual Studio Express 2010. Vista.
#5
Here is some source. Taken from another post.
#6
You need to create an OpenGL context before using any GL or Glu functions. Your code works correctly if you add a call to
glControl.CreateControl()right after you construct the GLControl. This is not normally necessary when you add the GLControl directly into a Form, as the Form will create all child controls automatically - however, you need to call it when you create a bare GLControl outside the normal WinForms environment.Closing (but please reopen if the issue perists :) )