mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-05 23:28:48 +00:00
Attributes; @(link_name="foo")
This commit is contained in:
+27
-27
@@ -11,35 +11,35 @@ export "core:opengl_constants.odin"
|
||||
_ := compile_assert(ODIN_OS != "osx");
|
||||
|
||||
foreign lib {
|
||||
Clear :: proc(mask: u32) #link_name "glClear" ---;
|
||||
ClearColor :: proc(r, g, b, a: f32) #link_name "glClearColor" ---;
|
||||
Begin :: proc(mode: i32) #link_name "glBegin" ---;
|
||||
End :: proc() #link_name "glEnd" ---;
|
||||
Finish :: proc() #link_name "glFinish" ---;
|
||||
BlendFunc :: proc(sfactor, dfactor: i32) #link_name "glBlendFunc" ---;
|
||||
Enable :: proc(cap: i32) #link_name "glEnable" ---;
|
||||
Disable :: proc(cap: i32) #link_name "glDisable" ---;
|
||||
GenTextures :: proc(count: i32, result: ^u32) #link_name "glGenTextures" ---;
|
||||
DeleteTextures :: proc(count: i32, result: ^u32) #link_name "glDeleteTextures"---;
|
||||
TexParameteri :: proc(target, pname, param: i32) #link_name "glTexParameteri" ---;
|
||||
TexParameterf :: proc(target: i32, pname: i32, param: f32) #link_name "glTexParameterf" ---;
|
||||
BindTexture :: proc(target: i32, texture: u32) #link_name "glBindTexture" ---;
|
||||
LoadIdentity :: proc() #link_name "glLoadIdentity" ---;
|
||||
Viewport :: proc(x, y, width, height: i32) #link_name "glViewport" ---;
|
||||
Ortho :: proc(left, right, bottom, top, near, far: f64) #link_name "glOrtho" ---;
|
||||
Color3f :: proc(r, g, b: f32) #link_name "glColor3f" ---;
|
||||
Vertex3f :: proc(x, y, z: f32) #link_name "glVertex3f" ---;
|
||||
GetError :: proc() -> i32 #link_name "glGetError" ---;
|
||||
GetString :: proc(name: i32) -> ^u8 #link_name "glGetString" ---;
|
||||
GetIntegerv :: proc(name: i32, v: ^i32) #link_name "glGetIntegerv" ---;
|
||||
TexCoord2f :: proc(x, y: f32) #link_name "glTexCoord2f" ---;
|
||||
TexImage2D :: proc(target, level, internal_format,
|
||||
width, height, border,
|
||||
format, type_: i32, pixels: rawptr) #link_name "glTexImage2D" ---;
|
||||
@(link_name="glClear") Clear :: proc(mask: u32) ---;
|
||||
@(link_name="glClearColor") ClearColor :: proc(r, g, b, a: f32) ---;
|
||||
@(link_name="glBegin") Begin :: proc(mode: i32) ---;
|
||||
@(link_name="glEnd") End :: proc() ---;
|
||||
@(link_name="glFinish") Finish :: proc() ---;
|
||||
@(link_name="glBlendFunc") BlendFunc :: proc(sfactor, dfactor: i32) ---;
|
||||
@(link_name="glEnable") Enable :: proc(cap: i32) ---;
|
||||
@(link_name="glDisable") Disable :: proc(cap: i32) ---;
|
||||
@(link_name="glGenTextures") GenTextures :: proc(count: i32, result: ^u32) ---;
|
||||
@(link_name="glDeleteTextures") DeleteTextures :: proc(count: i32, result: ^u32) ---;
|
||||
@(link_name="glTexParameteri") TexParameteri :: proc(target, pname, param: i32) ---;
|
||||
@(link_name="glTexParameterf") TexParameterf :: proc(target: i32, pname: i32, param: f32) ---;
|
||||
@(link_name="glBindTexture") BindTexture :: proc(target: i32, texture: u32) ---;
|
||||
@(link_name="glLoadIdentity") LoadIdentity :: proc() ---;
|
||||
@(link_name="glViewport") Viewport :: proc(x, y, width, height: i32) ---;
|
||||
@(link_name="glOrtho") Ortho :: proc(left, right, bottom, top, near, far: f64) ---;
|
||||
@(link_name="glColor3f") Color3f :: proc(r, g, b: f32) ---;
|
||||
@(link_name="glVertex3f") Vertex3f :: proc(x, y, z: f32) ---;
|
||||
@(link_name="glGetError") GetError :: proc() -> i32 ---;
|
||||
@(link_name="glGetString") GetString :: proc(name: i32) -> ^u8 ---;
|
||||
@(link_name="glGetIntegerv") GetIntegerv :: proc(name: i32, v: ^i32) ---;
|
||||
@(link_name="glTexCoord2f") TexCoord2f :: proc(x, y: f32) ---;
|
||||
@(link_name="glTexImage2D") TexImage2D :: proc(target, level, internal_format,
|
||||
width, height, border,
|
||||
format, type_: i32, pixels: rawptr) ---;
|
||||
}
|
||||
|
||||
|
||||
_string_data :: proc(s: string) -> ^u8 #inline { return &s[0]; }
|
||||
_string_data :: inline proc(s: string) -> ^u8 do return &s[0];
|
||||
|
||||
_libgl := win32.load_library_a(_string_data("opengl32.dll\x00"));
|
||||
|
||||
@@ -119,7 +119,7 @@ get_proc_address :: proc(name: string) -> rawptr {
|
||||
|
||||
|
||||
init :: proc() {
|
||||
set_proc_address :: proc(p: rawptr, name: string) #inline {
|
||||
set_proc_address :: proc(p: rawptr, name: string) {
|
||||
x := cast(^rawptr)p;
|
||||
x^ = get_proc_address(name);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user