示例#1
0
func (_ *NgUserIO) init(forceContextVersion float64) (err error) {
	UserIO.KeyToggleMinDelay, UserIO.lastToggles = 0.15, make(map[int]float64, 80)
	if !UserIO.isCtxInit {
		if err = UserIO.ctx.Init(); err == nil {
			UserIO.isCtxInit = true
		}
	}
	if UserIO.isCtxInit && !UserIO.Window.isCreated {
		var ctxProfile = ngctx.CtxProfile{ForwardCompat: Options.Initialization.GlContext.CoreProfile.ForwardCompat}
		if forceContextVersion > 0 {
			ctxProfile.Version.Major, ctxProfile.Version.Minor = ugl.VersionMajorMinor(forceContextVersion)
		}
		err = UserIO.recreateWin(&ctxProfile)
	}
	return
}
示例#2
0
func (_ *NgUserIO) init(forceContextVersion float64) (err error) {
	UserIO.KeyToggleMinDelay, UserIO.lastToggles = 0.15, make(map[int]float64, 80)
	if !UserIO.isGlfwInit {
		if err = glfw.Init(); err == nil {
			UserIO.isGlfwInit = true
		}
	}
	if UserIO.isGlfwInit && !UserIO.Window.isCreated {
		glfw.OpenWindowHint(glfw.FsaaSamples, 0) // AA will be a pluggable post-processing shader
		if forceContextVersion > 0 {
			major, minor := ugl.VersionMajorMinor(forceContextVersion)
			glfw.OpenWindowHint(glfw.OpenGLVersionMajor, major)
			glfw.OpenWindowHint(glfw.OpenGLVersionMinor, minor)
			glfw.OpenWindowHint(glfw.OpenGLProfile, glfw.OpenGLCoreProfile)
			if Options.Initialization.GlContext.CoreProfile.ForwardCompat {
				glfw.OpenWindowHint(glfw.OpenGLForwardCompat, 1)
			}
		}
		err = UserIO.recreateWin()
	}
	return
}