mirror of
https://github.com/ahwootech/BRUTAL.git
synced 2026-11-29 14:38:25 +01:00
SOURCE DUMP v1
This commit is contained in:
parent
bd62d51ec9
commit
fb20299e9d
1 changed files with 768360 additions and 0 deletions
25
brutal.opengl/Brutal.OpenGl/Glad.cs
Normal file
25
brutal.opengl/Brutal.OpenGl/Glad.cs
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Brutal.OpenGlApi;
|
||||
|
||||
public static partial class Glad
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes OpenGL by loading the GLAD library and setting up the function pointers for use in C#.
|
||||
/// </summary>
|
||||
/// <returns>True if initialization was successful, otherwise false.</returns>
|
||||
public static unsafe bool Initialize(GlGetProcAddressFunc loader)
|
||||
{
|
||||
var loaderPtr = Marshal.GetFunctionPointerForDelegate(loader);
|
||||
if (LoadGlLoader((nint*)loaderPtr) == 0)
|
||||
return false;
|
||||
|
||||
OpenGl.LoadPointers(entrypointU8 =>
|
||||
{
|
||||
fixed (byte* ptr = entrypointU8)
|
||||
return loader(ptr);
|
||||
});
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue