OpenGl3.Loader.pas 933 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. {
  2. FreePascal / Delphi bindings for ImGui
  3. Copyright (C) 2023 Coldzer0 <Coldzer0 [at] protonmail.ch>
  4. This program is free software: you can redistribute it and/or modify
  5. it under the terms of the MIT License.
  6. This program is distributed in the hope that it will be useful,
  7. but WITHOUT ANY WARRANTY; without even the implied warranty of
  8. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  9. MIT License for more details.
  10. }
  11. unit OpenGl3.Loader;
  12. {$IFDEF FPC}
  13. {$mode objfpc}{$H+}{$J-}
  14. {$ENDIF}
  15. interface
  16. uses
  17. glad_gl, {$IfDef SDL2}SDL2{$EndIf}{$IfDef GLFW3}GLFW3{$EndIf};
  18. function ImGLInit(): Boolean;
  19. implementation
  20. Function GLFuncLoad(proc: PAnsiChar): Pointer;
  21. Begin
  22. Result := {$IfDef GLFW3}glfwGetProcAddress{$ELSE}SDL_GL_GetProcAddress{$EndIf}(proc);
  23. Assert(Result <> nil, 'couldn''t load ' + proc);
  24. End;
  25. function ImGLInit(): Boolean;
  26. begin
  27. Result := gladLoadGL(@GLFuncLoad);
  28. end;
  29. end.