예제 #1
0
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        static void Main()
        {
            // this can be used to force other culture settings for testing..
            // System.Threading.Thread.CurrentThread.CurrentCulture = new CultureInfo("nl-NL");

            // The 'using' idiom guarantees proper resource cleanup.
            // We request 30 UpdateFrame events per second, and unlimited
            // RenderFrame events (as fast as the computer can handle).
            using (WavefrontOBJViewer game = new WavefrontOBJViewer())
            {
                Console.WriteLine("GL Version = {0}", GL.GetString(StringName.Version));
                Console.WriteLine("GL Shader Version = {0}", GL.GetString(StringName.ShadingLanguageVersion));

                // setup asset manager contexts
                // these help the asset manager find the "Asset" directy up above the bin/obj/Debug
                // output directories...
                SSAssetManager.AddAssetArchive(new SSAssetArchiveHandler_FileSystem("./Assets"));
                SSAssetManager.AddAssetArchive(new SSAssetArchiveHandler_FileSystem("../../Assets"));
                SSAssetManager.AddAssetArchive(new SSAssetArchiveHandler_FileSystem("../../../Assets"));
                SSAssetManager.AddAssetArchive(new SSAssetArchiveHandler_FileSystem("../../../../Assets"));

                game.shaderPgm = new SSMainShaderProgram();                 // before scene

                game.setupInput();

                game.setupScene();
                game.setupEnvironment();
                game.setupHUD();

                // game.VSync = VSyncMode.Off;
                game.Run(30.0);
            }
        }
예제 #2
0
        /// <summary>Creates a 800x600 window with the specified title.</summary>
        public TestBenchBootstrap(string windowName)
            : base(
                                #if false
                800, 600,
                GraphicsMode.Default,    // color format
                windowName,
                GameWindowFlags.Default, // windowed mode
                DisplayDevice.Default,   // primary monitor
                2, 2,                    // opengl version
                GraphicsContextFlags.Debug
                                #endif
                )
        {
            // this can be used to force other culture settings for testing..
            // System.Threading.Thread.CurrentThread.CurrentCulture = new CultureInfo("nl-NL");

            this.Title = windowName;
            VSync      = VSyncMode.On;
            restoreClientWindowLocation();

            Console.WriteLine("GL Version = {0}", GL.GetString(StringName.Version));
            Console.WriteLine("GL Shader Version = {0}", GL.GetString(StringName.ShadingLanguageVersion));

            // setup asset manager contexts
            // these help the asset manager find the "Asset" directy up above the bin/obj/Debug
            // output directories...
            SSAssetManager.AddAssetArchive(new SSAssetArchiveHandler_FileSystem("./Assets"));
            SSAssetManager.AddAssetArchive(new SSAssetArchiveHandler_FileSystem("../../Assets"));
            SSAssetManager.AddAssetArchive(new SSAssetArchiveHandler_FileSystem("../../../Assets"));
            SSAssetManager.AddAssetArchive(new SSAssetArchiveHandler_FileSystem("../../../../Assets"));

            mainShader = new SSMainShaderProgram();             // before mscene
            if (!mainShader.IsValid)
            {
                throw new Exception("Failed to build the main shader");
            }
            pssmShader = new SSPssmShaderProgram();
            if (!pssmShader.IsValid)
            {
                pssmShader = null;
            }
            instancingShader = new SSInstanceShaderProgram();
            if (!instancingShader.IsValid)
            {
                instancingShader = null;
            }
            else
            {
                instancingShader.debugLocations();
            }
            instancingPssmShader = new SSInstancePssmShaderProgram();
            if (!instancingPssmShader.IsValid)
            {
                instancingPssmShader = null;
            }

            setupInput();
            setupScene();
            setupCamera();
            setupEnvironment();
            setupHUD();
        }