# libsst-glapi

Thread-safe OpenGL 3.3 function loader with per-thread context management.

## Usage

```c
#include <SST/SST_GLAPI.h>

SST_GLAPI_InitForThread(NULL);  // NULL = platform default library

// Standard GL calls work via macros:
glClear(GL_COLOR_BUFFER_BIT);
glDrawArrays(GL_TRIANGLES, 0, 3);

SST_GLAPI_ShutdownForThread();
```

The macros in `SST_GLAPIMacros.h` dispatch through a thread-local
`SST_GLAPI` struct containing 334 function pointers.

## API

- `SST_GLAPI_InitForThread(libName)` -- load GL library, resolve all symbols
- `SST_GLAPI_ShutdownForThread()` -- release resources
- `SST_GLAPI_GetThreadGLAPI()` -- get current thread's function table
- `SST_GLAPI_CopyForThread(api)` -- install a custom function table

## Platform backends

| Platform | Library | Symbol resolution |
|---|---|---|
| Windows | opengl32.dll | `wglGetProcAddress` + `GetProcAddress` |
| Linux/POSIX | libGL.so.1 | `glXGetProcAddressARB` |
| macOS | OpenGL.framework | `dlsym` |

## Code generation

`parsegl.c` reads `gl33.txt` and generates `SST_GLAPIStruct.h`,
`SST_GLAPIStruct.c`, and `SST_GLAPIMacros.h`.
