示例#1
0
文件: gldebug.go 项目: Miaque/mojo
func TexSubImage2D(target Enum, level int, x, y, width, height int, format, ty Enum, data []byte) {
	defer func() {
		errstr := errDrain()
		log.Printf("gl.TexSubImage2D(%v, %v, %v, %v, %v, %v, %v, %v, len(%d)) %v", target, level, x, y, width, height, format, ty, len(data), errstr)
	}()
	C.glTexSubImage2D(target.c(), C.GLint(level), C.GLint(x), C.GLint(y), C.GLsizei(width), C.GLsizei(height), format.c(), ty.c(), unsafe.Pointer(&data[0]))
}
示例#2
0
文件: es2.go 项目: nick-fedesna/egles
func TexSubImage2D(target uint, level, xoffset, yoffset, width, height int,
	format, type_ uint, pixels Void) {

	C.glTexSubImage2D(C.GLenum(target), C.GLint(level),
		C.GLint(xoffset), C.GLint(yoffset), C.GLsizei(width), C.GLsizei(height),
		C.GLenum(format), C.GLenum(type_),
		unsafe.Pointer(pixels))
}
示例#3
0
文件: gles2.go 项目: remogatto/egles
func TexSubImage2D(
	target Enum, level int32, xoffset int32, yoffset int32,
	width Sizei, height Sizei, format Enum, type_ Enum, pixels Void) {
	C.glTexSubImage2D(
		C.GLenum(target),
		C.GLint(level),
		C.GLint(xoffset),
		C.GLint(yoffset),
		C.GLsizei(width),
		C.GLsizei(height),
		C.GLenum(format),
		C.GLenum(type_),
		unsafe.Pointer(pixels))
}
示例#4
0
文件: gla.go 项目: spate/gla
// TexSubImage2DFromImage loads texture data from an image.Image into the currently
// bound GL texture using the glTexSubImage2D call. If you wish to load only part of
// an image, pass a subimage as the argument.
//
// Precondition: no buffer object bound to PIXEL_UNPACK_BUFFER
//
// Additional state modified: UNPACK_ALIGNMENT, UNPACK_ROW_LENGTH
func TexSubImage2DFromImage(target GLenum, level int, dest image.Rectangle, img image.Image) {
	bounds := img.Bounds()
	if dest.Dx() > bounds.Dx() || dest.Dy() > bounds.Dy() {
		return
	}

	info := getImageInfo(img)

	C.glPixelStorei(C.GLenum(gl.UNPACK_ALIGNMENT), C.GLint(1))
	C.glPixelStorei(C.GLenum(gl.UNPACK_ROW_LENGTH), C.GLint(info.RowLength))
	C.glTexSubImage2D(C.GLenum(target), C.GLint(level),
		C.GLint(dest.Min.X), C.GLint(dest.Min.Y),
		C.GLsizei(dest.Dx()), C.GLsizei(dest.Dy()),
		C.GLenum(info.Format), C.GLenum(info.Type),
		info.Data)
}
示例#5
0
func TexSubImage2D(target Enum, level int, x, y, width, height int, format, ty Enum, data unsafe.Pointer) {
	C.glTexSubImage2D(target.c(), C.GLint(level), C.GLint(x), C.GLint(y), C.GLsizei(width), C.GLsizei(height), format.c(), ty.c(), data)
}
示例#6
0
文件: texture.go 项目: Nvveen/gl
//void glTexSubImage2D (GLenum target, int level, int xoffset, int yoffset, int width, int height, GLenum format, GLenum type, const GLvoid *pixels)
func TexSubImage2D(target GLenum, level int, xoffset int, yoffset int, width int, height int, format, typ GLenum, pixels interface{}) {
	C.glTexSubImage2D(C.GLenum(target), C.GLint(level), C.GLint(xoffset),
		C.GLint(yoffset), C.GLsizei(width), C.GLsizei(height), C.GLenum(format),
		C.GLenum(typ), ptr(pixels))
}
示例#7
0
func TexSubImageLuminance(target TextureTarget, level int, img *image.Gray) {
	a := adjustUnpackAlignment(img.Stride)
	C.glTexSubImage2D(C.GLenum(target), C.GLint(level), C.GLint(img.Rect.Min.X), C.GLint(img.Rect.Min.Y), C.GLsizei(img.Rect.Dx()), C.GLsizei(img.Rect.Dy()), C.GL_LUMINANCE, C.GL_UNSIGNED_BYTE, unsafe.Pointer(&img.Pix[0]))
	restoreAlignment(a)
}
示例#8
0
func TexSubImage2D(target TextureTarget, level, xoffset, yoffset, width, height int, format TextureFormat, datatype DataType, pixels []uint8) {
	C.glTexSubImage2D(C.GLenum(target), C.GLint(level), C.GLint(xoffset), C.GLint(yoffset), C.GLsizei(width), C.GLsizei(height), C.GLenum(format), C.GLenum(datatype), unsafe.Pointer(&pixels[0]))
}
示例#9
0
// TexSubImage2D writes a subregion of a 2D texture image.
//
// http://www.khronos.org/opengles/sdk/docs/man3/html/glTexSubImage2D.xhtml
func TexSubImage2D(target Enum, level int, x, y, width, height int, format, ty Enum, data []byte) {
	// TODO(crawshaw): GLES3 offset for PIXEL_UNPACK_BUFFER and PIXEL_PACK_BUFFER.
	C.glTexSubImage2D(target.c(), C.GLint(level), C.GLint(x), C.GLint(y), C.GLsizei(width), C.GLsizei(height), format.c(), ty.c(), unsafe.Pointer(&data[0]))
}