OpenGL rendering context cannot be created unless a call to an OpenGLfunction is made first.
Steps to Reproduce:
I’ve updated and re-uploaded the source code with the neccessary changes, to see the problem just comment out glGetError under Form1_Load event.
Actual Results: Rendering context is not created unless you make a call to an OpenGL API function first, otherwise, the rendering context will return a value of 0.
Expected Results:
You shouldn’t need to make a call to an OpenGL function first in order to create a rendering context.
Ay, this is a known problem, but it has nothing to do with .NET, but with Windows itself. The opengl32.dll must be loaded into memory prior to using the pixelformat functions, or otherwise you won’t be able to set the pixelformat. If I am not mistaken, the opengl32.dll substitutes the pixelformat calls of gdi32.dll with it’s own functions.
In .NET, a dll gets loaded when an imported function is called for the first time, so that’s explain your problem.