Пример #1
0
        public void Set(int w, int h)
        {
            GL.ClearColor(System.Drawing.Color.AliceBlue);
            GL.Enable(EnableCap.DepthTest);
            AppInfo.W    = w;
            AppInfo.H    = h;
            AppInfo.RW   = w;
            AppInfo.RH   = h;
            AppInfo.Full = false;
            AppInfo.App  = "GLApp";
            VImport.RegDefaults();
            for (int i = 0; i < 32; i++)
            {
                VInput.MB[i] = false;
            }
            VPen.InitDraw();
            VInput.InitInput();
            Vivid.Sound.VSoundSys.Init();
            GL.Viewport(0, 0, w, h);
            GL.Scissor(0, 0, w, h);
            GL.Disable(EnableCap.Blend);
            GL.Disable(EnableCap.Texture2D);
            GL.Enable(EnableCap.CullFace);
            GL.CullFace(CullFaceMode.Back);
            GL.Disable(EnableCap.StencilTest);
            GL.Disable(EnableCap.ScissorTest);
            GL.Enable(EnableCap.DepthTest);
            GL.DepthRange(0, 1);

            GL.ClearDepth(1.0f);
            GL.DepthFunc(DepthFunction.Less);
            // UI.UISys.ActiveUI.OnResize(Width, Height);
            VPen.SetProj(0, 0, w, h);
        }
Пример #2
0
        public VApp(string app, int width, int height, bool full) : base(width, height, OpenTK.Graphics.GraphicsMode.Default, app, full ? GameWindowFlags.Fullscreen : GameWindowFlags.Default, DisplayDevice.Default, 4, 5, OpenTK.Graphics.GraphicsContextFlags.ForwardCompatible)

        {
            Link         = this;
            _Title       = app;
            AppInfo.W    = width;
            AppInfo.H    = height;
            AppInfo.RW   = width;
            AppInfo.RH   = height;
            AppInfo.Full = full;
            AppInfo.App  = app;
            VImport.RegDefaults();
            for (int i = 0; i < 32; i++)
            {
                VInput.MB[i] = false;
            }
            VPen.InitDraw();
            VInput.InitInput();
            Vivid.Sound.VSoundSys.Init();
        }
Пример #3
0
        public override void InitState()
        {
            VAssImpImp.IPath = "c:/med/";
            ER = new VEnvRenderer(512, 512);
            PR = new VPostProcessRenderer(512, 512);
            // PR.Add(new VPPBlur());
            sg       = new VSceneGraph();
            PR.Scene = sg;
            ER.Scene = sg;

            e1            = VImport.ImportNode("c:/Media/dwarf2.b3d"); //file of 3d model to load.
            e1.LocalScale = new Vector3(1, 1, 1);

            var m1 = new VMaterial();

            m1.TCol = new VTex2D("c:/Media/tex1_c.png", LoadMethod.Single); // texture to load
            m1.TEnv = VTextureUtil.LoadCubeMap("c:/Media/cm1.png.cube");    // cubemap to load. use cubeconvert to convert.
            //m2.TEnv = ER.FB.Cube;
            var ee = e1 as VSceneEntity;

            //var ee2 = e2 as VSceneEntity; //building project atm.
            SetMat(ee, m1);

            // SetMat(ee2, m2);
            sg.Add(e1);
            // sg.Add(e2);

            c1 = new VCam();
            sg.Add(c1);
            l1 = new VLight();
            l1.Pos(new Vector3(0, 40, 0), Space.Local);
            c1.Pos(new Vector3(0, 0, 300), Space.Local);
            c1.LookAt(Vector3.Zero, new Vector3(0, 1, 0));
            sg.Add(l1);
            //e1.Pos(new Vector3(0, -30, 0), Space.Local);
            // e2.Pos(new Vector3(0, 20, 0), Space.Local);
        }