github.com/Seikaijyu/gio@v0.0.1/internal/gl/types_js.go (about) 1 // SPDX-License-Identifier: Unlicense OR MIT 2 3 package gl 4 5 import "syscall/js" 6 7 type ( 8 Object js.Value 9 Buffer Object 10 Framebuffer Object 11 Program Object 12 Renderbuffer Object 13 Shader Object 14 Texture Object 15 Query Object 16 Uniform Object 17 VertexArray Object 18 ) 19 20 func (o Object) valid() bool { 21 return js.Value(o).Truthy() 22 } 23 24 func (o Object) equal(o2 Object) bool { 25 return js.Value(o).Equal(js.Value(o2)) 26 } 27 28 func (b Buffer) Valid() bool { 29 return Object(b).valid() 30 } 31 32 func (f Framebuffer) Valid() bool { 33 return Object(f).valid() 34 } 35 36 func (p Program) Valid() bool { 37 return Object(p).valid() 38 } 39 40 func (r Renderbuffer) Valid() bool { 41 return Object(r).valid() 42 } 43 44 func (s Shader) Valid() bool { 45 return Object(s).valid() 46 } 47 48 func (t Texture) Valid() bool { 49 return Object(t).valid() 50 } 51 52 func (u Uniform) Valid() bool { 53 return Object(u).valid() 54 } 55 56 func (a VertexArray) Valid() bool { 57 return Object(a).valid() 58 } 59 60 func (f Framebuffer) Equal(f2 Framebuffer) bool { 61 return Object(f).equal(Object(f2)) 62 } 63 64 func (p Program) Equal(p2 Program) bool { 65 return Object(p).equal(Object(p2)) 66 } 67 68 func (s Shader) Equal(s2 Shader) bool { 69 return Object(s).equal(Object(s2)) 70 } 71 72 func (u Uniform) Equal(u2 Uniform) bool { 73 return Object(u).equal(Object(u2)) 74 } 75 76 func (a VertexArray) Equal(a2 VertexArray) bool { 77 return Object(a).equal(Object(a2)) 78 } 79 80 func (r Renderbuffer) Equal(r2 Renderbuffer) bool { 81 return Object(r).equal(Object(r2)) 82 } 83 84 func (t Texture) Equal(t2 Texture) bool { 85 return Object(t).equal(Object(t2)) 86 } 87 88 func (b Buffer) Equal(b2 Buffer) bool { 89 return Object(b).equal(Object(b2)) 90 }