Exemple #1
0
func TestInterfacesBehavesAsExpected(t *T) {
	var a, b Double = 4, 4
	ass.True(iseq(a, b))
	var c, d string = "aa", "aa"
	ass.True(iseq(c, d))
	var e, f int = 8, 8
	ass.True(iseq(e, f))
	var g, h Coord = Coord{2, 4}, Coord{2, 4}
	ass.True(iseq(g, h))
	var i, j *Coord = &g, &h
	ass.False(iseq(i, j))
}
Exemple #2
0
func TestProjection(t *T) {
	var ratio Double = 1.2
	var znear, zfar, fovx Double = 0.01, 65536.0, 80.0
	ass.True(fovx.ToRad() < 7.0)
	var m = Projection(fovx.ToRad(), ratio, znear, zfar)
	t.Logf("projection works: %v\n", m)
}
Exemple #3
0
func New(vert, frag string) *Program {
	ass.True(util.GlSupportsVersion(2, 0))
	vsh := NewShader(true)
	fsh := NewShader(false)
	vsrc, fsrc := vertShaderSource(vert), fragShaderSource(frag)
	vsrc = PreprocessShaderSource(vsrc)
	fsrc = PreprocessShaderSource(fsrc)
	vsh.Source(vsrc)
	fsh.Source(fsrc)
	vsh.Compile()
	fsh.Compile()
	prog := new(Program)
	prog.vparam, prog.fparam = vert, frag //save params
	prog.id = gl.CreateProgram()
	prog.AttachShader(vsh)
	prog.AttachShader(fsh)
	prog.Link()
	if GUsedProgram == nil {
		GUsedProgram = prog
	}
	return prog
}
Exemple #4
0
func New() *Vbo {
	ass.True(util.GlSupportsVersion(1, 4))
	v := new(Vbo)
	v.InitData()
	return v
}