mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 15:48:51 +00:00
Nearly finished Jai-like declarations
This commit is contained in:
+27
-27
@@ -2,37 +2,37 @@
|
||||
import win32 "sys/windows.odin" when ODIN_OS == "windows";
|
||||
include "opengl_constants.odin";
|
||||
|
||||
proc Clear (mask u32) #foreign "glClear"
|
||||
proc ClearColor (r, g, b, a f32) #foreign "glClearColor"
|
||||
proc Begin (mode i32) #foreign "glBegin"
|
||||
proc End () #foreign "glEnd"
|
||||
proc Finish () #foreign "glFinish"
|
||||
proc BlendFunc (sfactor, dfactor i32) #foreign "glBlendFunc"
|
||||
proc Enable (cap i32) #foreign "glEnable"
|
||||
proc Disable (cap i32) #foreign "glDisable"
|
||||
proc GenTextures (count i32, result ^u32) #foreign "glGenTextures"
|
||||
proc DeleteTextures(count i32, result ^u32) #foreign "glDeleteTextures"
|
||||
proc TexParameteri (target, pname, param i32) #foreign "glTexParameteri"
|
||||
proc TexParameterf (target i32, pname i32, param f32) #foreign "glTexParameterf"
|
||||
proc BindTexture (target i32, texture u32) #foreign "glBindTexture"
|
||||
proc LoadIdentity () #foreign "glLoadIdentity"
|
||||
proc Viewport (x, y, width, height i32) #foreign "glViewport"
|
||||
proc Ortho (left, right, bottom, top, near, far f64) #foreign "glOrtho"
|
||||
proc Color3f (r, g, b f32) #foreign "glColor3f"
|
||||
proc Vertex3f (x, y, z f32) #foreign "glVertex3f"
|
||||
proc TexImage2D (target, level, internal_format,
|
||||
width, height, border,
|
||||
format, _type i32, pixels rawptr) #foreign "glTexImage2D"
|
||||
Clear :: proc(mask u32) #foreign "glClear"
|
||||
ClearColor :: proc(r, g, b, a f32) #foreign "glClearColor"
|
||||
Begin :: proc(mode i32) #foreign "glBegin"
|
||||
End :: proc() #foreign "glEnd"
|
||||
Finish :: proc() #foreign "glFinish"
|
||||
BlendFunc :: proc(sfactor, dfactor i32) #foreign "glBlendFunc"
|
||||
Enable :: proc(cap i32) #foreign "glEnable"
|
||||
Disable :: proc(cap i32) #foreign "glDisable"
|
||||
GenTextures :: proc(count i32, result ^u32) #foreign "glGenTextures"
|
||||
DeleteTextures:: proc(count i32, result ^u32) #foreign "glDeleteTextures"
|
||||
TexParameteri :: proc(target, pname, param i32) #foreign "glTexParameteri"
|
||||
TexParameterf :: proc(target i32, pname i32, param f32) #foreign "glTexParameterf"
|
||||
BindTexture :: proc(target i32, texture u32) #foreign "glBindTexture"
|
||||
LoadIdentity :: proc() #foreign "glLoadIdentity"
|
||||
Viewport :: proc(x, y, width, height i32) #foreign "glViewport"
|
||||
Ortho :: proc(left, right, bottom, top, near, far f64) #foreign "glOrtho"
|
||||
Color3f :: proc(r, g, b f32) #foreign "glColor3f"
|
||||
Vertex3f :: proc(x, y, z f32) #foreign "glVertex3f"
|
||||
TexImage2D :: proc(target, level, internal_format,
|
||||
width, height, border,
|
||||
format, _type i32, pixels rawptr) #foreign "glTexImage2D"
|
||||
|
||||
proc GetError () -> i32 #foreign "glGetError"
|
||||
proc GetString (name i32) -> ^byte #foreign "glGetString"
|
||||
proc GetIntegerv(name i32, v ^i32) #foreign "glGetIntegerv"
|
||||
GetError :: proc() -> i32 #foreign "glGetError"
|
||||
GetString :: proc(name i32) -> ^byte #foreign "glGetString"
|
||||
GetIntegerv :: proc(name i32, v ^i32) #foreign "glGetIntegerv"
|
||||
|
||||
|
||||
|
||||
_libgl := win32.LoadLibraryA(("opengl32.dll\x00" as string).data);
|
||||
|
||||
proc GetProcAddress(name string) -> proc() #cc_c {
|
||||
GetProcAddress :: proc(name string) -> proc() #cc_c {
|
||||
assert(name[name.count-1] == 0);
|
||||
res := win32.wglGetProcAddress(name.data);
|
||||
if res == nil {
|
||||
@@ -99,8 +99,8 @@ UniformMatrix4fv: proc(loc i32, count u32, transpose i32, value ^f32) #cc_c;
|
||||
|
||||
GetUniformLocation: proc(program u32, name ^byte) -> i32 #cc_c;
|
||||
|
||||
proc init() {
|
||||
proc set_proc_address(p rawptr, name string) #inline { (p as ^(proc() #cc_c))^ = GetProcAddress(name); }
|
||||
init :: proc() {
|
||||
set_proc_address :: proc(p rawptr, name string) #inline { (p as ^(proc() #cc_c))^ = GetProcAddress(name); }
|
||||
|
||||
set_proc_address(^GenBuffers, "glGenBuffers\x00");
|
||||
set_proc_address(^GenVertexArrays, "glGenVertexArrays\x00");
|
||||
|
||||
Reference in New Issue
Block a user