示例#1
0
func TexturesTest() {
	out := make([]int32, 1)
	gl.GetIntegerv(gl.MAX_TEXTURE_IMAGE_UNITS, out)
	maxUnits := int(out[0])

	for i := 0; i < maxUnits; i++ {
		gl.ActiveTexture(gl.GLenum(gl.TEXTURE0 + i))

		gl.GetIntegerv(gl.TEXTURE_BINDING_1D, out)
		texture := gl.Texture(out[0])
		if texture != 0 {
			fmt.Println("unit: ", i, " texture1d: ", texture)
		}

		gl.GetIntegerv(gl.TEXTURE_BINDING_2D, out)
		texture = gl.Texture(out[0])
		if texture != 0 {
			fmt.Println("unit: ", i, " texture2d: ", texture)
		}

		gl.GetIntegerv(gl.TEXTURE_BINDING_RECTANGLE, out)
		texture = gl.Texture(out[0])
		if texture != 0 {
			fmt.Println("unit: ", i, " textureRect: ", texture)
		}

		gl.GetIntegerv(gl.TEXTURE_BINDING_CUBE_MAP, out)
		texture = gl.Texture(out[0])
		if texture != 0 {
			fmt.Println("unit: ", i, " textureCube: ", texture)
		}

		gl.GetIntegerv(gl.TEXTURE_BINDING_3D, out)
		texture = gl.Texture(out[0])
		if texture != 0 {
			fmt.Println("unit: ", i, " texture3d: ", texture)
		}
	}

	gl.ActiveTexture(gl.TEXTURE0)
}
func getEnum(enum gl.GLenum) gl.GLenum {
	i, _, _, _ := gl.GetInteger4(gl.TEXTURE_BINDING_2D)
	return gl.GLenum(i)
}
示例#3
0
func (t *Texture) Paramf(filter int, value float32) {
	t.Bind()
	gl.TexParameterf(t.target, gl.GLenum(filter), value)
}
示例#4
0
func (t *Texture) SetWraping(wrapType WrapType, wrap Wrap) {
	t.Bind()
	gl.TexParameteri(t.target, gl.GLenum(wrapType), int(wrap))
}
示例#5
0
func (t *Texture) Param(filter, value int) {
	t.Bind()
	gl.TexParameteri(t.target, gl.GLenum(filter), value)
}