Merge pull request #2230 from ftphikari/master

sys/windows: added helper gl proc
This commit is contained in:
Jeroen van Rijn
2022-12-05 23:05:31 +01:00
committed by GitHub
2 changed files with 7 additions and 8 deletions

View File

@@ -85,3 +85,8 @@ foreign Opengl32 {
wglUseFontBitmaps :: proc(hdc: HDC, first, count, list_base: DWORD) -> BOOL ---
wglUseFontOutlines :: proc(hdc: HDC, first, count, list_base: DWORD, deviation, extrusion: f32, format: c.int, gmf: LPGLYPHMETRICSFLOAT) -> BOOL ---
}
// Used by vendor:OpenGL
gl_set_proc_address :: proc(p: rawptr, name: cstring) {
(^rawptr)(p)^ = wglGetProcAddress(name)
}

View File

@@ -7,17 +7,11 @@ Includes procedures to load OpenGL function pointers. Currently only supports th
```go
gl.load_up_to(4, 5, proc(p: rawptr, name: cstring) do (cast(^rawptr)p)^ = glfw.GetProcAddress(name); );
```
[odin-glfw](https://github.com/vassvik/odin-glfw) also provides a useful helper you can pass straight to `gl.load_up_to`:
`vendor:glfw` also provides a useful helper you can pass straight to `gl.load_up_to`:
```go
gl.load_up_to(4, 5, glfw.gl_set_proc_address);
```
#### NOTE: It is recommended to put this into the shared collection:
```
cd /path/to/Odin/shared
git clone https://github.com/vassvik/odin-gl.git
```
## Extra utility procedures (Outdated. See the end of `gl.odin`)
Some useful helper procedures can be found in `helpers.odin`, for tasks such as:
@@ -56,4 +50,4 @@ glGetError() returned NO_ERROR
glGetError() returned NO_ERROR
call: glClearColor(0.800, 0.800, 0.800, 1.000)
in: C:/<snip>/main.odin(272:6)
```
```