Golang C.GLsizeiptr类(方法)实例源码

下面列出了Golang C.GLsizeiptr 类(方法)源码代码实例,从而了解它的用法。

作者:Miaqu    项目:moj   
func BufferInit(target Enum, size int, usage Enum) {
	defer func() {
		errstr := errDrain()
		log.Printf("gl.BufferInit(%v, %v, %v) %v", target, size, usage, errstr)
	}()
	C.glBufferData(target.c(), C.GLsizeiptr(size), nil, usage.c())
}

作者:Miaqu    项目:moj   
func BufferData(target Enum, usage Enum, src []byte) {
	defer func() {
		errstr := errDrain()
		log.Printf("gl.BufferData(%v, %v, len(%d)) %v", target, usage, len(src), errstr)
	}()
	C.glBufferData(target.c(), C.GLsizeiptr(len(src)), unsafe.Pointer(&src[0]), usage.c())
}

作者:Miaqu    项目:moj   
func BufferSubData(target Enum, offset int, data []byte) {
	defer func() {
		errstr := errDrain()
		log.Printf("gl.BufferSubData(%v, %v, len(%d)) %v", target, offset, len(data), errstr)
	}()
	C.glBufferSubData(target.c(), C.GLintptr(offset), C.GLsizeiptr(len(data)), unsafe.Pointer(&data[0]))
}

作者:spat    项目:gl   
// BufferData uses glBufferData to allocate memory for the bound GL buffer,
// and fills it with the data in slice. slice can be either a slice or pointer.
// Behaviour is undefined if the underlying data type is or contains anything
// other than sized numeric types. (Structs and arrays are okay as long as they're
// of sized numeric types. Pointers and slices are only allowed at the topmost level.)
func BufferData(target GLenum, slice interface{}, usage GLenum) error {
	data, e := sliceToUintptr(slice)
	if e != nil {
		return e
	}
	C.glBufferData(C.GLenum(target), C.GLsizeiptr(data.Size*data.Length), unsafe.Pointer(data.Ptr), C.GLenum(usage))
	return nil
}

作者:spat    项目:gl   
// BufferSubData uses glBufferSubData to update a section of the buffer
// currently bound to target. The buffer's type is treated as being an array
// of the same type as slice. Trying to set data off the end of the buffer
// is not checked, and will likely result in a GL error.
//
// This function sets:
//   buffer_bound_to_target[start:start+len(slice)] = slice[:]
func BufferSubData(target GLenum, start_index int, slice interface{}) error {
	data, e := sliceToUintptr(slice)
	if e != nil {
		return e
	}
	C.glBufferSubData(C.GLenum(target), C.GLintptr(uintptr(start_index)*data.Size), C.GLsizeiptr(data.Size*data.Length), unsafe.Pointer(data.Ptr))
	return nil
}

作者:extram    项目:g   
// Set calls glBufferData with appropriate arguments to load the data pointed to by data into the buffer. usage is passed along verbatim. targ is used for binding and it should most likely be ARRAY_BUFFER.
func (buf *Buffer) Set(targ int, data interface{}, usage int) {
	buf.Bind(targ)
	p, t, ts, s := toCtype(data)
	C.glBufferData(C.GLenum(targ), C.GLsizeiptr(s), p, C.GLenum(usage))
	buf.t = t
	buf.ts = ts
	buf.Unbind(targ)
}

作者:remogatt    项目:egle   
func BufferData(
	target Enum, size SizeiPtr,
	data Void, usage Enum) {
	C.glBufferData(
		C.GLenum(target),
		C.GLsizeiptr(size),
		unsafe.Pointer(data),
		C.GLenum(usage))

}

作者:remogatt    项目:egle   
func BufferSubData(
	target Enum, offset IntPtr,
	size SizeiPtr, data Void) {
	C.glBufferSubData(
		C.GLenum(target),
		C.GLintptr(offset),
		C.GLsizeiptr(size),
		unsafe.Pointer(data))

}

作者:Congenita    项目:goandroi   
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)))
}

作者:jacksca    项目:go-gles   
func BufferDataf(target BufferTarget, data []float32, usage BufferUsage) {
	C.glBufferData(C.GLenum(target), C.GLsizeiptr(unsafe.Sizeof(data[0])*uintptr(len(data))), unsafe.Pointer(&data[0]), C.GLenum(usage))
}

作者:shibukaw    项目:g   
func BufferSubData(target Enum, offset int, data []byte) {
	C.glBufferSubData(target.c(), C.GLintptr(offset), C.GLsizeiptr(len(data)), unsafe.Pointer(&data[0]))
}

作者:shibukaw    项目:g   
func BufferData(target Enum, src []byte, usage Enum) {
	C.glBufferData(target.c(), C.GLsizeiptr(len(src)), unsafe.Pointer(&src[0]), usage.c())
}

作者:skar    项目:GarageEngin   
// Creates and initializes a buffer object's data store
func BufferData(target GLenum, size int, data interface{}, usage GLenum) {
	C.glBufferData(C.GLenum(target), C.GLsizeiptr(size), ptr(data), C.GLenum(usage))
}

作者:skar    项目:GarageEngin   
// Bind this buffer range as index of target
func (buffer Buffer) BindBufferRange(target GLenum, index uint, offset int, size uint) {
	C.glBindBufferRange(C.GLenum(target), C.GLuint(index), C.GLuint(buffer), C.GLintptr(offset), C.GLsizeiptr(size))
}

作者:skar    项目:GarageEngin   
// Returns a subset of a buffer object's data store
func GetBufferSubData(target GLenum, offset int, size int, data interface{}) {
	C.glGetBufferSubData(C.GLenum(target), C.GLintptr(offset),
		C.GLsizeiptr(size), ptr(data))
}

作者:eaburn    项目:g   
// BufferSubData updates a subset of a buffer object's data store.
func BufferSubData(targ BufferTarget, offs int, data interface{}) {
	_, sz, ptr := rawData(data)
	C.glBufferSubData(C.GLenum(targ), C.GLintptr(offs), C.GLsizeiptr(sz), ptr)
}

作者:tanem    项目:amor   
func BufferInit(target Enum, size int, usage Enum) {
	C.glBufferData(target.c(), C.GLsizeiptr(size), nil, usage.c())
}

作者:nick-fedesn    项目:egle   
func BufferData(target uint, size int, data Void, usage uint) {
	C.glBufferData(
		C.GLenum(target), C.GLsizeiptr(size),
		unsafe.Pointer(data), C.GLenum(usage))
}

作者:nick-fedesn    项目:egle   
func BufferSubData(target uint, offset int, size int, data Void) {
	C.glBufferSubData(
		C.GLenum(target), C.GLintptr(offset),
		C.GLsizeiptr(size), unsafe.Pointer(data))
}

作者:jacksca    项目:go-gles   
func BufferData(target BufferTarget, size int, usage BufferUsage) {
	C.glBufferData(C.GLenum(target), C.GLsizeiptr(size), nil, C.GLenum(usage))
}


问题


面经


文章

微信
公众号

扫码关注公众号