diff options
| author | Colin Davidson <colrdavidson@gmail.com> | 2024-01-24 13:24:25 -0800 |
|---|---|---|
| committer | Colin Davidson <colrdavidson@gmail.com> | 2024-01-24 13:24:25 -0800 |
| commit | f93f2dfd5cf56383e33f3eb7d2773c4646b37e2f (patch) | |
| tree | 2e698e8ea2b2cf9f67c79d904c0707ded46cb485 /vendor | |
| parent | 98b539ac5c64004c1bd1d3f8fed5e59028b12739 (diff) | |
Add support for basic EGL on Linux
Diffstat (limited to 'vendor')
| -rw-r--r-- | vendor/egl/egl.odin | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/vendor/egl/egl.odin b/vendor/egl/egl.odin new file mode 100644 index 000000000..cf6a02b7a --- /dev/null +++ b/vendor/egl/egl.odin @@ -0,0 +1,61 @@ +//+build linux +package egl + +NativeDisplayType :: rawptr +NativeWindowType :: rawptr +Display :: rawptr +Surface :: rawptr +Config :: rawptr +Context :: rawptr + +NO_DISPLAY :: Display(uintptr(0)) +NO_CONTEXT :: Context(uintptr(0)) +NO_SURFACE :: Surface(uintptr(0)) + +CONTEXT_OPENGL_CORE_PROFILE_BIT :: 0x00000001 +WINDOW_BIT :: 0x0004 +OPENGL_BIT :: 0x0008 + +BLUE_SIZE :: 0x3022 +GREEN_SIZE :: 0x3023 +RED_SIZE :: 0x3024 +DEPTH_SIZE :: 0x3025 +STENCIL_SIZE :: 0x3026 + +SURFACE_TYPE :: 0x3033 +NONE :: 0x3038 +COLOR_BUFFER_TYPE :: 0x303F +RENDERABLE_TYPE :: 0x3040 +CONFORMANT :: 0x3042 + +BACK_BUFFER :: 0x3084 +RENDER_BUFFER :: 0x3086 +GL_COLORSPACE_SRGB :: 0x3089 +GL_COLORSPACE_LINEAR :: 0x308A +RGB_BUFFER :: 0x308E +GL_COLORSPACE :: 0x309D + +CONTEXT_MAJOR_VERSION :: 0x3098 +CONTEXT_MINOR_VERSION :: 0x30FB +CONTEXT_OPENGL_PROFILE_MASK :: 0x30FD + +OPENGL_API :: 0x30A2 + +foreign import egl "system:EGL" +@(default_calling_convention="c", link_prefix="egl") +foreign egl { + GetDisplay :: proc(display: NativeDisplayType) -> Display --- + Initialize :: proc(display: Display, major: ^i32, minor: ^i32) -> i32 --- + BindAPI :: proc(api: u32) -> i32 --- + ChooseConfig :: proc(display: Display, attrib_list: ^i32, configs: ^Context, config_size: i32, num_config: ^i32) -> i32 --- + CreateWindowSurface :: proc(display: Display, config: Config, native_window: NativeWindowType, attrib_list: ^i32) -> Surface --- + CreateContext :: proc(display: Display, config: Config, share_context: Context, attrib_list: ^i32) -> Context --- + MakeCurrent :: proc(display: Display, draw: Surface, read: Surface, ctx: Context) -> i32 --- + SwapInterval :: proc(display: Display, interval: i32) -> i32 --- + SwapBuffers :: proc(display: Display, surface: Surface) -> i32 --- + GetProcAddress :: proc(name: cstring) -> rawptr --- +} + +gl_set_proc_address :: proc(p: rawptr, name: cstring) { + (^rawptr)(p)^ = GetProcAddress(name) +} |