示例#1
0
文件: gldebug.go 项目: Miaque/mojo
func BindBuffer(target Enum, b Buffer) {
	defer func() {
		errstr := errDrain()
		log.Printf("gl.BindBuffer(%v, %v) %v", target, b, errstr)
	}()
	C.glBindBuffer(target.c(), b.c())
}
示例#2
0
func (game *game) initGL() {
	log.Printf("GL_VERSION: %v GL_RENDERER: %v GL_VENDOR %v\n",
		GetString(C.GL_VERSION), GetString(C.GL_RENDERER), GetString(C.GL_VENDOR))
	log.Printf("GL_EXTENSIONS: %v\n", GetString(C.GL_EXTENSIONS))
	C.glClearColor(0.0, 0.0, 0.0, 1.0)
	C.glEnable(C.GL_CULL_FACE)
	C.glEnable(C.GL_DEPTH_TEST)

	game.prog = createProgram(vertShaderSrcDef, fragShaderSrcDef)
	posAttrib := attribLocation(game.prog, "vPosition")
	game.offsetUni = uniformLocation(game.prog, "offset")
	game.colorUni = uniformLocation(game.prog, "color")
	C.glUseProgram(game.prog)
	C.glEnableVertexAttribArray(C.GLuint(posAttrib))

	vertVBO := GenBuffer()
	checkGLError()
	C.glBindBuffer(C.GL_ARRAY_BUFFER, vertVBO)
	verts := []float32{.0, 0.5, -0.5, -0.5, 0.5, -0.5}
	C.glBufferData(C.GL_ARRAY_BUFFER, C.GLsizeiptr(len(verts)*int(unsafe.Sizeof(verts[0]))), unsafe.Pointer(&verts[0]), C.GL_STATIC_DRAW)
	C.glVertexAttribPointer(C.GLuint(posAttrib), 2, C.GL_FLOAT, C.GL_FALSE, 0, unsafe.Pointer(uintptr(0)))
}
示例#3
0
func BindBuffer(target Enum, b Buffer) {
	C.glBindBuffer(target.c(), b.c())
}
示例#4
0
文件: gles2.go 项目: remogatto/egles
func BindBuffer(
	target Enum, buffer uint32) {
	C.glBindBuffer(
		C.GLenum(target),
		C.GLuint(buffer))
}
示例#5
0
文件: gl.go 项目: extrame/gl
// Unbind calls glBindBuffer with a 0 argument
func (*Buffer) Unbind(targ int) {
	C.glBindBuffer(C.GLenum(targ), 0)
}
示例#6
0
文件: gl.go 项目: extrame/gl
// Bind calls glBindBuffer
func (buf *Buffer) Bind(targ int) {
	C.glBindBuffer(C.GLenum(targ), buf.i)
}
示例#7
0
func BindBuffer(target BufferTarget, buffer Buffer) {
	C.glBindBuffer(C.GLenum(target), C.GLuint(buffer))
}
示例#8
0
// Remove buffer binding
func (buffer Buffer) Unbind(target GLenum) {
	C.glBindBuffer(C.GLenum(target), C.GLuint(0))
}
示例#9
0
文件: bufobjs.go 项目: eaburns/gl
// Bind binds a named buffer object.
func (b Buffer) Bind(targ BufferTarget) {
	C.glBindBuffer(C.GLenum(targ), C.GLuint(b))
}