This repository provides the Free Pascal / Lazarus headers required to interface with the GLFW library.
(The following description is sourced from the official GLFW website:)
GLFW is an Open Source, multi-platform library designed for OpenGL, OpenGL ES, and Vulkan development on the desktop. It offers a simple API for creating windows, contexts, and surfaces, as well as for receiving input and events.
GLFW is written in C and provides native support for Windows, macOS, and many Unix-like systems using the X Window System, such as Linux and FreeBSD.
- Download: Get the
glfw.pasunit from the folder corresponding to your desired version (e.g.,GLFW34). - Library Files: - Windows: Place
glfw3_32.dll(32-bit) orglfw3_64.dll(64-bit) in your project folder or system path.- Linux/macOS: Ensure the native GLFW library is installed via your package manager.
- Integration: Add the unit to your
usesclause:
uses
glfw,dglOpenGL;Inside the Examples folder, you will find:
multiplewindows.pas: A complete port of the official GLFWwindows.cexample, demonstrating how to manage 4 independent windows with different background colors.
GLFW handles window creation and input, but it does not include OpenGL functions (like glClear, glBegin, etc.). To draw inside your windows, you need an OpenGL loader.
We recommend using dglOpenGL.pas alongside these headers:
uses
glfw, dglOpenGL;
begin
// After glfwMakeContextCurrent(window)
if not InitOpenGL then Halt;
ReadExtensions;
// Now you can use OpenGL commands
glClearColor(0.1, 0.2, 0.3, 1.0);
end;While these headers include GLFW's Vulkan-related functions, they are primarily designed for OpenGL development. For more details on how to use Vulkan with this unit, please refer to vulkan_status.md.
- GLFW Library: Official Team
- Pascal Headers: Jorge Turiel (Blueicaro)
- Testing & Examples: Jorge Turiel (Blueicaro)
These headers are distributed under the Zlib License, the same license used by the official GLFW project. See the LICENSE file for more details.