Exemplo n.º 1
0
func DepthFunc(fn Enum) {
	defer func() {
		errstr := errDrain()
		log.Printf("gl.DepthFunc(%v) %v", fn, errstr)
	}()
	C.glDepthFunc(fn.c())
}
Exemplo n.º 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")

}
Exemplo n.º 3
0
func DepthFunc(fn Enum) {
	C.glDepthFunc(fn.c())
}
Exemplo n.º 4
0
func DepthFunc(
	func_ Enum) {
	C.glDepthFunc(
		C.GLenum(func_))

}
Exemplo n.º 5
0
func DepthFunc(f TestFunc) {
	C.glDepthFunc(C.GLenum(f))
}
Exemplo n.º 6
0
func DepthFunc(f uint) { C.glDepthFunc(C.GLenum(f)) }