Skip to content

Omustardo/bytecoder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

bytecoder provides functions for converting various slices into byte slices. Based on the Bytes function from https://github.com/golang/mobile/blob/master/exp/f32/f32.go

I have found this to be of use when working with OpenGL buffers:

// Store basic rectangle vertices in a buffer.
vertices := bytecoder.Float32(binary.LittleEndian,
    0, 0,
    1, 0,
    1, 1,
    0, 1,
)
buf := gl.CreateBuffer()
gl.BindBuffer(gl.ARRAY_BUFFER, buf)
gl.BufferData(gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW)

About

Encode to Byte Arrays

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages