mirror of
https://github.com/Ryujinx/Opentk.git
synced 2024-12-23 11:55:31 +00:00
Fixed core loading on Windows
On Windows, entry points for OpenGL 1.0 and 1.1 are not exposed by wglGetProcAddress. We fall back to LoadLibrary+GetProcAddress when wglProcAddress fails.
This commit is contained in:
parent
c92c232910
commit
e65f206554
|
@ -338,7 +338,22 @@ namespace OpenTK.Platform.Windows
|
|||
|
||||
public override IntPtr GetAddress(string function_string)
|
||||
{
|
||||
return Wgl.Imports.GetProcAddress(function_string);
|
||||
IntPtr address = Wgl.Imports.GetProcAddress(function_string);
|
||||
if (!IsValid(address))
|
||||
{
|
||||
address = Functions.GetProcAddress(opengl32Handle, function_string);
|
||||
}
|
||||
return address;
|
||||
}
|
||||
|
||||
static bool IsValid(IntPtr address)
|
||||
{
|
||||
unsafe
|
||||
{
|
||||
// See https://www.opengl.org/wiki/Load_OpenGL_Functions
|
||||
void* a = address.ToPointer();
|
||||
return a < (void*)-1 || a > (void*)3;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
Loading…
Reference in a new issue