github.com/Seikaijyu/gio@v0.0.1/internal/gl/types.go (about)

     1  //go:build !js
     2  // +build !js
     3  
     4  package gl
     5  
     6  type (
     7  	Object       struct{ V uint }
     8  	Buffer       Object
     9  	Framebuffer  Object
    10  	Program      Object
    11  	Renderbuffer Object
    12  	Shader       Object
    13  	Texture      Object
    14  	Query        Object
    15  	Uniform      struct{ V int }
    16  	VertexArray  Object
    17  )
    18  
    19  func (o Object) valid() bool {
    20  	return o.V != 0
    21  }
    22  
    23  func (o Object) equal(o2 Object) bool {
    24  	return o == o2
    25  }
    26  
    27  func (u Framebuffer) Valid() bool {
    28  	return Object(u).valid()
    29  }
    30  
    31  func (u Uniform) Valid() bool {
    32  	return u.V != -1
    33  }
    34  
    35  func (p Program) Valid() bool {
    36  	return Object(p).valid()
    37  }
    38  
    39  func (s Shader) Valid() bool {
    40  	return Object(s).valid()
    41  }
    42  
    43  func (a VertexArray) Valid() bool {
    44  	return Object(a).valid()
    45  }
    46  
    47  func (f Framebuffer) Equal(f2 Framebuffer) bool {
    48  	return Object(f).equal(Object(f2))
    49  }
    50  
    51  func (p Program) Equal(p2 Program) bool {
    52  	return Object(p).equal(Object(p2))
    53  }
    54  
    55  func (s Shader) Equal(s2 Shader) bool {
    56  	return Object(s).equal(Object(s2))
    57  }
    58  
    59  func (u Uniform) Equal(u2 Uniform) bool {
    60  	return u == u2
    61  }
    62  
    63  func (a VertexArray) Equal(a2 VertexArray) bool {
    64  	return Object(a).equal(Object(a2))
    65  }
    66  
    67  func (r Renderbuffer) Equal(r2 Renderbuffer) bool {
    68  	return Object(r).equal(Object(r2))
    69  }
    70  
    71  func (t Texture) Equal(t2 Texture) bool {
    72  	return Object(t).equal(Object(t2))
    73  }
    74  
    75  func (b Buffer) Equal(b2 Buffer) bool {
    76  	return Object(b).equal(Object(b2))
    77  }