예제 #1
0
파일: gldebug.go 프로젝트: Miaque/mojo
func DepthFunc(fn Enum) {
	defer func() {
		errstr := errDrain()
		log.Printf("gl.DepthFunc(%v) %v", fn, errstr)
	}()
	C.glDepthFunc(fn.c())
}
예제 #2
0
func InitGL(width, height, msaa int, fullscreen bool) {
	C.SDL_Init(C.SDL_INIT_VIDEO)
	C.SDL_VideoInit( /*nil*/ C.SDL_GetVideoDriver(0))
	C.SDL_GL_SetAttribute(C.SDL_GL_CONTEXT_MAJOR_VERSION, 3)
	C.SDL_GL_SetAttribute(C.SDL_GL_CONTEXT_MINOR_VERSION, 2)

	if msaa != 0 {
		C.SDL_GL_SetAttribute(C.SDL_GL_MULTISAMPLEBUFFERS, 1)
		C.SDL_GL_SetAttribute(C.SDL_GL_MULTISAMPLESAMPLES, C.int(msaa))
	}

	C.SDL_GL_SetAttribute(C.SDL_GL_DEPTH_SIZE, 16)
	//win = C.SDL_CreateWindow(nil, C.SDL_WINDOWPOS_CENTERED, C.SDL_WINDOWPOS_CENTERED,C.int(width), C.int(height), C.SDL_WINDOW_OPENGL)
	if fullscreen {
		win = C.SDL_CreateWindow(nil, C.SDL_WINDOWPOS_CENTERED, C.SDL_WINDOWPOS_CENTERED, C.int(width), C.int(height), C.SDL_WINDOW_OPENGL|C.SDL_WINDOW_FULLSCREEN_DESKTOP)
	} else {
		win = C.SDL_CreateWindow(nil, C.SDL_WINDOWPOS_CENTERED, C.SDL_WINDOWPOS_CENTERED, C.int(width), C.int(height), C.SDL_WINDOW_OPENGL)
	}

	C.SDL_ShowWindow(win)
	wat := C.SDL_GL_CreateContext(win)
	fmt.Println(C.GoString(C.SDL_GetVideoDriver(0)))

	C.SDL_GL_MakeCurrent(win, wat)
	//C.SDL_GL_SetSwapInterval(1)

	C.glEnable(C.GL_DEPTH_TEST)
	C.glDepthFunc(C.GL_LEQUAL)

	C.glClearColor(0.3, 0.5, 1, 0)
	C.glClear(C.GL_COLOR_BUFFER_BIT | C.GL_DEPTH_BUFFER_BIT)
	printerr("failed to initialize openGL")

}
예제 #3
0
파일: gl_opengles.go 프로젝트: tanema/amore
func DepthFunc(fn Enum) {
	C.glDepthFunc(fn.c())
}
예제 #4
0
파일: gles2.go 프로젝트: remogatto/egles
func DepthFunc(
	func_ Enum) {
	C.glDepthFunc(
		C.GLenum(func_))

}
예제 #5
0
파일: gl.go 프로젝트: jackscan/go-gles2
func DepthFunc(f TestFunc) {
	C.glDepthFunc(C.GLenum(f))
}
예제 #6
0
파일: es2.go 프로젝트: nick-fedesna/egles
func DepthFunc(f uint) { C.glDepthFunc(C.GLenum(f)) }