Example #1
0
File: rt.go Project: skyview059/vu
// drawScene renders the single texture on the quad.
func (rt *rtrace) drawScene() {
	gl.Clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT)
	gl.UseProgram(rt.shaders)
	gl.Uniform1i(rt.tex2D, 0)
	gl.ActiveTexture(gl.TEXTURE0 + 0)
	gl.BindVertexArray(rt.vao)
	gl.UniformMatrix4fv(rt.mvpId, 1, false, rt.mvp.Pointer())
	gl.DrawElements(gl.TRIANGLES, int32(len(rt.faces)), gl.UNSIGNED_BYTE, 0)

	// cleanup
	gl.ActiveTexture(0)
	gl.UseProgram(0)
	gl.BindVertexArray(0)
}
Example #2
0
// useTexture makes the given texture the active texture.
func (gc *opengl) useTexture(sampler, texUnit int32, tid uint32) {
	gc.bindUniform(sampler, i1, 1, texUnit)
	gl.ActiveTexture(gl.TEXTURE0 + uint32(texUnit))
	gl.BindTexture(gl.TEXTURE_2D, tid)
}