Closed ericlass closed 7 years ago
From version 0.4 the OpenGL procedure loading has changed to have more clean DeviceContext
implementation.
To solve your issue, just call Gl.BindAPI()
after you Wgl.MakeCurrent
call. I'm pretty sure that it will solve the problem. Alternatively, you can use DeviceContext
abstraction.
The reason behind it is that OpenGL method pointers are loaded by calling Gl.BindAPI()
; in previous versions this method was executed automatically by Wgl.MakeCurrent
, while now you have to do it manually. Sorry, I promised to document the BindAPI
methods, but I didn't it yet.
Additionally, be aware of Gl.Initialize()
; if you construct the OpenGL context yourself, I suggest to call this method before any of your code.
Works perfectly when calling both Initialize() and BindAPI(). Thanks for quick help. And also for the library. ;)
Hi, I've been using OpenGL.Net for a while now, without any issues. I'm creating the window and the context manually and all worked fine until today, I removed the pre-compiled OpenGL.Net assembly (compiled August 2015) and instead installed the NuGet package (version 0.4.0). Window and context creation still work fine, but Gl.GetString(StringName.Version) now returns NULL. Gl.GetError() says InvalidOperation, but already does so before calling GetString(), right after making the context the current. Here's my code:
As written before, all checks pass successful, but Gl.GetString() still returns NULL. Do you have any ideas what could cause this? Using the pre-compiled assembly, the above code works perfectly fine. The issue is only with the NuGet package.
Thanks and regards, Eric