Esempio n. 1
0
File: gl_test.go Progetto: shogg/gl
func TestTexCoordPointer(t *testing.T) {

	gl.EnableClientState(gl.TEXTURE_COORD_ARRAY)

	gl.TexCoordPointer(3, gl.INT, 0, &array)
	if gl.GetError() != gl.NO_ERROR {
		t.Error("pointer to array failed")
	}

	gl.TexCoordPointer(3, gl.INT, 0, slice)
	if gl.GetError() != gl.NO_ERROR {
		t.Error("slice failed")
	}

	gl.DisableClientState(gl.TEXTURE_COORD_ARRAY)
	buf := newBuffer(16 * 4)
	defer buf.Delete()

	gl.TexCoordPointer(3, gl.INT, 0, uintptr(0))
	if gl.GetError() != gl.NO_ERROR {
		t.Error("buffer offset failed")
	}
}
Esempio n. 2
0
File: main.go Progetto: shogg/glvox
func initGl() {

	h := float64(height) / float64(width)

	gl.ShadeModel(gl.FLAT)

	gl.Viewport(0, 0, width, height)
	gl.MatrixMode(gl.PROJECTION)
	gl.LoadIdentity()
	gl.Frustum(-1.0, 1.0, -h, h, 5.0, 60.0)

	gl.MatrixMode(gl.MODELVIEW)
	gl.LoadIdentity()
	gl.Translatef(0.0, 0.0, -6.0)

	gl.EnableClientState(gl.VERTEX_ARRAY)
	gl.EnableClientState(gl.TEXTURE_COORD_ARRAY)
	gl.VertexPointer(3, gl.FLOAT, 0, vertices)
	gl.TexCoordPointer(2, gl.FLOAT, 0, texCoords)
}