Recently I received a support request from someone who was trying to run a game I wrote a couple of years ago, but when it started they said they just saw a brown screen. I daresay my code is at fault somewhere, but as I've ran it on a variety of VM's and Windows machines without issue I do wonder if it just might not be.
I wanted to send the user a small app that would use
OpenTK to determine the version and capabilities of their system. However, when I tried to write one - just as a standard Windows Forms app, I discovered that attempting to call
GL.GetString (or anything else) would throw a null reference exception. Which makes perfect sense if you need to initialize OpenGL first.
If I create a
GameWindow object then calling
GL.GetString returns something. However, if I dispose of the
GameWindow as soon as it's created, then whilst
GL.GetString no longer crashes, it returns
string.Empty where previously it would have returned a valid value.
My question is two-fold really.
Firstly, is there a convenient method of initializing OpenGL without having to create a
GameWindow (I'm not using the
GLControl either). Or should I just create the window, ask my questions, then dispose of it afterwards?
Secondly, is there a simple way of detecting what is supported? My game was fairly primitive in how it used OpenGL... 2D textures,
GL.DrawArrays, and some primitive drawing using
GL.End - all 1.x stuff as I recall.
I haven't touched the game for a couple of years as I haven't had much time, so it'll take me a while to remember how my engine works and get my head back around OpenGL and how I was (mis)using it.