Exemple #1
0
        static void Main(string[] args)
        {
            int w = 400;
            int h = 400;

            Glut.glutInit();
            Gl.glEnable(Gl.GL_DEPTH_TEST);
            Glut.glutInitDisplayMode(Glut.GLUT_DEPTH | Glut.GLUT_SINGLE | Glut.GLUT_RGB);
            Glut.glutInitWindowSize(w, h);
            Glut.glutInitWindowPosition(400, 300);
            Glut.glutCreateWindow("Pradzia");
            Init();
            Glut.glutDisplayFunc(new Glut.DisplayCallback(Vaizdavimas));
            Glut.glutSpecialFunc(new Glut.SpecialCallback(Klaviatura));
            Glut.glutCreateMenu(new Glut.CreateMenuCallback(Menu));
            Glut.glutReshapeFunc(new Glut.ReshapeCallback(Perpiesti));
            Glut.glutAddMenuEntry("Difuse", 1);
            Glut.glutAddMenuEntry("Specular", 2);
            Glut.glutAddMenuEntry("Ambient", 3);
            Glut.glutAddMenuEntry("Du sviesos saltiniai", 4);
            Glut.glutAddMenuEntry("+45 laipsniai X", 5);
            Glut.glutAddMenuEntry("-45 laipsniai X", 6);
            Glut.glutAddMenuEntry("Pabaiga", 9);
            Glut.glutAttachMenu(Glut.GLUT_RIGHT_BUTTON);
            Glut.glutMainLoop();
        }
Exemple #2
0
        public static void Run()
        {
            Glut.glutInit();
            Glut.glutInitDisplayMode(Glut.GLUT_DEPTH | Glut.GLUT_DOUBLE | Glut.GLUT_RGB);
            Glut.glutInitWindowPosition(50, 50);
            Glut.glutCreateWindow("Voronoi");

            Glut.glutDisplayFunc(new Glut.DisplayCallback(Display));
            Glut.glutKeyboardFunc(new Glut.KeyboardCallback(Keyboard));
            Glut.glutMouseFunc(new Glut.MouseCallback(Mouse));
            Glut.glutReshapeFunc(new Glut.ReshapeCallback(Reshape));

            Glut.glutCreateMenu(new Glut.CreateMenuCallback(Menu));
            Glut.glutAddMenuEntry("Voronoi", 0);
            Glut.glutAddMenuEntry("", 0);
            Glut.glutAddMenuEntry("[r] Reset", (int)'r');
            Glut.glutAddMenuEntry("[p] Toggle points", (int)'p');
            Glut.glutAddMenuEntry("", 0);
            Glut.glutAddMenuEntry("Quit", 27);
            Glut.glutAttachMenu(Glut.GLUT_RIGHT_BUTTON);

            Init();

            Glut.glutMainLoop();
        }
Exemple #3
0
        static void Main(string[] args)
        {
            int w = 400;
            int h = 400;

            Glut.glutInit();
            Glut.glutInitDisplayMode(Glut.GLUT_SINGLE | Glut.GLUT_RGB);
            Glut.glutInitWindowSize(w, h);
            Glut.glutInitWindowPosition(400, 300);
            Glut.glutCreateWindow("Pradzia");
            Init();
            Glut.glutDisplayFunc(new Glut.DisplayCallback(Piesk));
            Glut.glutCreateMenu(new Glut.CreateMenuCallback(Menu));
            Glut.glutAddMenuEntry("(1)Ketvirtis is virsaus", 1);
            Glut.glutAddMenuEntry("(2)Figura is virsaus", 2);
            Glut.glutAddMenuEntry("(3)Figura is sono", 3);
            Glut.glutAddMenuEntry("(4)Fugura paversta", 4);
            Glut.glutAddMenuEntry("(5)Sumazint, pasukt ir pastumt", 5);
            Glut.glutAddMenuEntry("(6)glu.Perspective", 6);
            Glut.glutAddMenuEntry("(7)glFrustum", 7);
            Glut.glutAddMenuEntry("Astuntas punktas", 8);
            Glut.glutAddMenuEntry("Pabaiga", 9);
            Glut.glutAttachMenu(Glut.GLUT_RIGHT_BUTTON);
            Glut.glutMainLoop();
        }
Exemple #4
0
 static void menuNos()
 {
     Glut.glutCreateMenu(mymenu); // single menu, no need for id
     Glut.glutAddMenuEntry("Caminho mais curto", 1);
     Glut.glutAddMenuEntry("Caminho mais forte", 2);
     Glut.glutAddMenuEntry("Back", 3);
     Glut.glutAttachMenu(Glut.GLUT_RIGHT_BUTTON);
 }
Exemple #5
0
        private void createPopupMenus()
        {
            int menu;

            menu = Glut.glutCreateMenu(this.processMenuEvents);

            Glut.glutAddMenuEntry(AppState.Instance.ResourceManager.GetString("Music1"), 11);
            Glut.glutAddMenuEntry(AppState.Instance.ResourceManager.GetString("Music2"), 12);

            Glut.glutAttachMenu(Glut.GLUT_RIGHT_BUTTON);
        }
Exemple #6
0
 static void Main(string[] args)
 {
     Glut.glutInit();
     Glut.glutInitDisplayMode(Glut.GLUT_SINGLE | Glut.GLUT_RGB);
     Glut.glutInitWindowSize(400, 400);
     Glut.glutInitWindowPosition(400, 300);
     Glut.glutCreateWindow("Grafiniai primityvai");
     Init();
     Glut.glutDisplayFunc(new Glut.DisplayCallback(figura));
     Glut.glutCreateMenu(new Glut.CreateMenuCallback(Menu));
     Glut.glutAddMenuEntry("(1)I Ketvirtis", 1);
     Glut.glutAddMenuEntry("(2)II Ketvirtis", 2);
     Glut.glutAddMenuEntry("(3)III Ketvirtis", 3);
     Glut.glutAddMenuEntry("(4)IV Ketvirtis", 4);
     Glut.glutAddMenuEntry("(5)Sumazint, pasukt ir pastumt", 5);
     Glut.glutAttachMenu(Glut.GLUT_RIGHT_BUTTON);
     Glut.glutReshapeFunc(new Glut.ReshapeCallback(Reshape));
     Glut.glutMainLoop();                  //pradedamas vykdyti grafinės programos ciklas
 }
Exemple #7
0
        public static void Run()
        {
            Glut.glutInit();
            Glut.glutInitDisplayMode(Glut.GLUT_SINGLE | Glut.GLUT_RGB | Glut.GLUT_DEPTH);
            Glut.glutInitWindowSize(450, 150);
            Glut.glutCreateWindow("FogOld");
            Init();
            Glut.glutDisplayFunc(new Glut.DisplayCallback(Display));
            Glut.glutKeyboardFunc(new Glut.KeyboardCallback(Keyboard));
            Glut.glutReshapeFunc(new Glut.ReshapeCallback(Reshape));

            Glut.glutCreateMenu(new Glut.CreateMenuCallback(Menu));
            Glut.glutAddMenuEntry("Fog EXP", Gl.GL_EXP);
            Glut.glutAddMenuEntry("Fog EXP2", Gl.GL_EXP2);
            Glut.glutAddMenuEntry("Fog LINEAR", Gl.GL_LINEAR);
            Glut.glutAddMenuEntry("Quit", 0);
            Glut.glutAttachMenu(Glut.GLUT_RIGHT_BUTTON);

            Glut.glutMainLoop();
        }
        public static void Run()
        {
            Glut.glutInit();
            Glut.glutInitDisplayMode(Glut.GLUT_DOUBLE | Glut.GLUT_RGB | Glut.GLUT_DEPTH);
            Glut.glutCreateWindow("SurfaceOld");
            Init();
            Glut.glutDisplayFunc(new Glut.DisplayCallback(Display));
            Glut.glutKeyboardFunc(new Glut.KeyboardCallback(Keyboard));
            Glut.glutMotionFunc(new Glut.MotionCallback(Motion));
            Glut.glutMouseFunc(new Glut.MouseCallback(Mouse));
            Glut.glutReshapeFunc(new Glut.ReshapeCallback(Reshape));

            Glut.glutCreateMenu(new Glut.CreateMenuCallback(Menu));
            Glut.glutAddMenuEntry("Show control points", 1);
            Glut.glutAddMenuEntry("Hide control points", 0);
            Glut.glutAddMenuEntry("Solid", 2);
            Glut.glutAddMenuEntry("Wireframe", 3);
            Glut.glutAttachMenu(Glut.GLUT_RIGHT_BUTTON);

            Glut.glutMainLoop();
        }
Exemple #9
0
        public static void Main(string[] args)
        {
            Glut.glutInit();
            Glut.glutInitDisplayMode(Glut.GLUT_DEPTH | Glut.GLUT_DOUBLE | Glut.GLUT_MULTISAMPLE | Glut.GLUT_RGBA);
            Glut.glutInitWindowSize(800, 600);
            Glut.glutInitWindowPosition(50, 50);
            Glut.glutCreateWindow("Maiden");

            Glut.glutDisplayFunc(new Glut.DisplayCallback(Display));
            Glut.glutKeyboardFunc(new Glut.KeyboardCallback(Keyboard));
            Glut.glutIdleFunc(new Glut.IdleCallback(Idle));
            Glut.glutReshapeFunc(new Glut.ReshapeCallback(Reshape));
            Glut.glutSpecialFunc(new Glut.SpecialCallback(Special));

            Glut.glutCreateMenu(new Glut.CreateMenuCallback(Menu));
            Glut.glutAddMenuEntry("Toggle texture mapping", (int)'t');
            Glut.glutAddMenuEntry("Toggle texture mode", (int)'m');
            Glut.glutAddMenuEntry("Toggle filter mode", (int)'f');
            Glut.glutAddMenuEntry("Toggle performance", (int)'p');
            Glut.glutAddMenuEntry("Toggle background", (int)'b');
            Glut.glutAddMenuEntry("Toggle animation", (int)' ');
            Glut.glutAddMenuEntry("Toggle culling", (int)'c');
            Glut.glutAddMenuEntry("Toggle stars", (int)'*');
            Glut.glutAddMenuEntry("Time full frame (no swap)", (int)'n');
            Glut.glutAddMenuEntry("Print pixels/frame", (int)'r');
            Glut.glutAddMenuEntry("", 0);
            Glut.glutAddMenuEntry("> and < keys change # of textures", 0);
            Glut.glutAddMenuEntry("Arrows up/down change level of detail", 0);
            Glut.glutAddMenuEntry("Arrows right/left change # of spheres", 0);
            Glut.glutAddMenuEntry("1-4 keys change background image", 0);
            Glut.glutAddMenuEntry("", 0);
            Glut.glutAddMenuEntry("Quit", (int)'r');
            Glut.glutAttachMenu(Glut.GLUT_RIGHT_BUTTON);

            Init();
            LoadTextures();

            Glut.glutMainLoop();
        }
Exemple #10
0
 static void Main(string[] args)
 //programos vykdymo pradžia
 {                                                                      //
     Glut.glutInit();                                                   //inicializuojama GLUT aplinka
     Glut.glutInitDisplayMode(Glut.GLUT_SINGLE | Glut.GLUT_RGB);        //nustatomi vaizdavimo parametrai
     Glut.glutInitWindowSize(400, 400);                                 //nustatomas programos lango dydis
     Glut.glutInitWindowPosition(400, 300);                             //nustatoma lango pozicija
     Glut.glutCreateWindow("NIF06020");                                 //sukuriamas langas
     Init();                                                            //papildomi OpenGL būsenų nustatymai
     Glut.glutDisplayFunc(new Glut.DisplayCallback(Figura));            //vaizdavimo metodo uzregistravimas
     Glut.glutKeyboardFunc(new Glut.KeyboardCallback(Klaviatura1));     //metodo klaviatura1 uzregistravimas
     Glut.glutSpecialFunc(new Glut.SpecialCallback(Klaviatura2));       //metodo klaviatura2 uzregistravimas
     Glut.glutMouseFunc(new Glut.MouseCallback(Pele));                  //metodo pele uzregistravimas
     Glut.glutCreateMenu(new Glut.CreateMenuCallback(Meniu));           //metodo meniu uzregistravimas
     Glut.glutAddMenuEntry("Pirmas punktas", '1');                      //i kontekstini meniu itraukiamas pirmas pasirinkimas
     Glut.glutAddMenuEntry("Antras punktas", '2');                      //i kontekstini meniu itraukiamas antras pasirinkimas
     Glut.glutAddMenuEntry("Trecias punktas", '3');                     //i kontekstini meniu itraukiamas trecias pasirinkimas
     Glut.glutAddMenuEntry("Ketvirtas punktas", '4');                   //i kontekstini meniu itraukiamas ketvirtas pasirinkimas
     Glut.glutAddMenuEntry("Penktas punktas", '5');                     //i kontekstini meniu itraukiamas penktas pasirinkimas
     Glut.glutAddMenuEntry("Progamos pabaiga", '6');                    //i kontekstini meniu itraukiamas sestas pasirinkimas
     Glut.glutAttachMenu(Glut.GLUT_RIGHT_BUTTON);                       //uzregistuojamas iskleidziamas meniu
     Glut.glutMainLoop();                                               //pradedamas vykdyti grafines programos ciklas
 }                                                                      //
Exemple #11
0
        public static void Run()
        {
            string filePath       = Path.Combine("..", "..");
            string fileDirectory  = "Data";
            string vertexFileName = "C6E1v_bulge.cg";

            if (File.Exists(vertexFileName))
            {
                filePath      = "";
                fileDirectory = "";
            }
            else if (File.Exists(Path.Combine(fileDirectory, vertexFileName)))
            {
                filePath = "";
            }

            string myVertexProgramFileName = Path.Combine(Path.Combine(filePath, fileDirectory), vertexFileName);

            // Callback Delegates
            keyboardDelegate += keyboard;
            menuDelegate     += menu;
            idleDelegate     += idle;
            reshapeDelegate  += reshape;

            Glut.glutInitWindowSize(400, 400);
            Glut.glutInitDisplayMode(Glut.GLUT_RGB | Glut.GLUT_DOUBLE | Glut.GLUT_DEPTH);
            Glut.glutInit();

            Glut.glutCreateWindow(myProgramName);
            Glut.glutDisplayFunc(display);
            Glut.glutKeyboardFunc(keyboardDelegate);
            Glut.glutReshapeFunc(reshapeDelegate);

            Gl.glClearColor(0.1f, 0.1f, 0.5f, 0f); /* Gray background. */
            Gl.glEnable(Gl.GL_DEPTH_TEST);         /* Hidden surface removal. */

            myCgContext = Cg.cgCreateContext();
            checkForCgError("creating context");

            myCgVertexProfile = CgGl.cgGLGetLatestProfile(CgGl.CG_GL_VERTEX);
            CgGl.cgGLSetOptimalOptions(myCgVertexProfile);
            checkForCgError("selecting vertex profile");

            myCgVertexProgram =
                Cg.cgCreateProgramFromFile(
                    myCgContext,             /* Cg runtime context */
                    Cg.CG_SOURCE,            /* Program in human-readable form */
                    myVertexProgramFileName, /* Name of file containing program */
                    myCgVertexProfile,       /* Profile: OpenGL ARB vertex program */
                    myVertexProgramName,     /* Entry function name */
                    null);                   /* No extra compiler options */
            checkForCgError("creating vertex program from file");
            CgGl.cgGLLoadProgram(myCgVertexProgram);
            checkForCgError("loading vertex program");

            GET_PARAM("modelViewProj");
            GET_PARAM("time");
            GET_PARAM("frequency");
            GET_PARAM("scaleFactor");
            GET_PARAM("Kd");
            GET_PARAM("shininess");
            GET_PARAM("eyePosition");
            GET_PARAM("lightPosition");
            GET_PARAM("lightColor");

            /* Set light source color parameters once. */
            Cg.cgSetParameter3fv(myCgVertexParam_lightColor, out myLightColor[0]);

            Cg.cgSetParameter1f(myCgVertexParam_scaleFactor, 0.3f);
            Cg.cgSetParameter1f(myCgVertexParam_frequency, 2.4f);
            Cg.cgSetParameter1f(myCgVertexParam_shininess, 35f);

            myCgFragmentProfile = CgGl.cgGLGetLatestProfile(CgGl.CG_GL_FRAGMENT);
            CgGl.cgGLSetOptimalOptions(myCgFragmentProfile);
            checkForCgError("selecting fragment profile");

            /* Specify fragment program with a string. */
            myCgFragmentProgram =
                Cg.cgCreateProgram(
                    myCgContext,         /* Cg runtime context */
                    Cg.CG_SOURCE,        /* Program in human-readable form */
                    "float4 main(float4 c : COLOR) : COLOR { return c; }",
                    myCgFragmentProfile, /* Profile: latest fragment profile */
                    "main",              /* Entry function name */
                    null);               /* No extra commyPiler options */
            checkForCgError("creating fragment program from string");
            CgGl.cgGLLoadProgram(myCgFragmentProgram);
            checkForCgError("loading fragment program");

            /* Specify vertex program for rendering the light source with a
             * string. */
            myCgLightVertexProgram =
                Cg.cgCreateProgram(
                    myCgContext,          /* Cg runtime context */
                    Cg.CG_SOURCE,         /* Program in human-readable form */
                    "void main(inout float4 p : POSITION, " +
                    "uniform float4x4 modelViewProj, " +
                    "out float4 c : COLOR) " +
                    "{ p = mul(modelViewProj, p); c = float4(1,1,0,1); }",
                    myCgVertexProfile, /* Profile: latest fragment profile */
                    "main",            /* Entry function name */
                    null);             /* No extra commyPiler options */
            checkForCgError("creating light vertex program from string");
            CgGl.cgGLLoadProgram(myCgLightVertexProgram);
            checkForCgError("loading light vertex program");

            myCgLightVertexParam_modelViewProj =
                Cg.cgGetNamedParameter(myCgLightVertexProgram, "modelViewProj");
            checkForCgError("could not get modelViewProj parameter");

            Glut.glutCreateMenu(menu);
            Glut.glutAddMenuEntry("[ ] Animate", ' ');
            Glut.glutAttachMenu(Glut.GLUT_RIGHT_BUTTON);

            // Change Animation to true, so that it starts with action ;-)
            keyboard((byte)' ', 0, 0);

            Glut.glutMainLoop();
        }
Exemple #12
0
        public static void Main(string[] args)
        {
            int menuID, subMenuA, subMenuB;

            Glut.glutInitDisplayString("stencil~2 rgb double depth>=16 samples");
            Glut.glutInitDisplayMode(Glut.GLUT_RGB | Glut.GLUT_DOUBLE | Glut.GLUT_DEPTH);
            Glut.glutInitWindowPosition(100, 100);

            Glut.glutInit();

            subMenuA = Glut.glutCreateMenu(SampleMenu);
            Glut.glutAddMenuEntry("Sub menu A1 (01)", 1);
            Glut.glutAddMenuEntry("Sub menu A2 (02)", 2);
            Glut.glutAddMenuEntry("Sub menu A3 (03)", 3);

            subMenuB = Glut.glutCreateMenu(SampleMenu);
            Glut.glutAddMenuEntry("Sub menu B1 (04)", 4);
            Glut.glutAddMenuEntry("Sub menu B2 (05)", 5);
            Glut.glutAddMenuEntry("Sub menu B3 (06)", 6);
            Glut.glutAddSubMenu("Going to sub menu A", subMenuA);

            menuID = Glut.glutCreateMenu(SampleMenu);
            Glut.glutAddMenuEntry("Entry one", 1);
            Glut.glutAddMenuEntry("Entry two", 2);
            Glut.glutAddMenuEntry("Entry three", 3);
            Glut.glutAddMenuEntry("Entry four", 4);
            Glut.glutAddMenuEntry("Entry five", 5);
            Glut.glutAddSubMenu("Enter sub menu A", subMenuA);
            Glut.glutAddSubMenu("Enter sub menu B", subMenuB);

            Glut.glutCreateWindow("Hello world!");
            Glut.glutDisplayFunc(new Glut.DisplayCallback(SampleDisplay));
            Glut.glutReshapeFunc(new Glut.ReshapeCallback(SampleReshape));
            Glut.glutKeyboardFunc(new Glut.KeyboardCallback(SampleKeyboard));
            Glut.glutSpecialFunc(new Glut.SpecialCallback(SampleSpecial));
            Glut.glutIdleFunc(new Glut.IdleCallback(SampleIdle));
            Glut.glutAttachMenu(Glut.GLUT_LEFT_BUTTON);

            Glut.glutInitWindowPosition(200, 200);
            Glut.glutCreateWindow("I am not Jan B.");
            Glut.glutDisplayFunc(new Glut.DisplayCallback(SampleDisplay));
            Glut.glutReshapeFunc(new Glut.ReshapeCallback(SampleReshape));
            Glut.glutKeyboardFunc(new Glut.KeyboardCallback(SampleKeyboard));
            Glut.glutSpecialFunc(new Glut.SpecialCallback(SampleSpecial));
            Glut.glutIdleFunc(new Glut.IdleCallback(SampleIdle));
            Glut.glutAttachMenu(Glut.GLUT_LEFT_BUTTON);

            Console.WriteLine("Testing game mode string parsing, don't panic!\n");
            Glut.glutGameModeString("320x240:32@100");
            Glut.glutGameModeString("640x480:16@72");
            Glut.glutGameModeString("1024x768");
            Glut.glutGameModeString(":32@120");
            Glut.glutGameModeString("Toudi glupcze, Danwin bedzie moj!");
            Glut.glutGameModeString("640x480:16@72");

            Glut.glutEnterGameMode();
            Glut.glutDisplayFunc(new Glut.DisplayCallback(SampleDisplay));
            Glut.glutReshapeFunc(new Glut.ReshapeCallback(SampleReshape));
            Glut.glutKeyboardFunc(new Glut.KeyboardCallback(SampleGameModeKeyboard));
            Glut.glutIdleFunc(new Glut.IdleCallback(SampleIdle));
            Glut.glutAttachMenu(Glut.GLUT_LEFT_BUTTON);

            Console.WriteLine("current window is %ix%i+%i+%i",
                              Glut.glutGet(Glut.GLUT_WINDOW_X), Glut.glutGet(Glut.GLUT_WINDOW_Y),
                              Glut.glutGet(Glut.GLUT_WINDOW_WIDTH), Glut.glutGet(Glut.GLUT_WINDOW_HEIGHT)
                              );

            /*
             * Enter the main FreeGLUT processing loop
             */
            Glut.glutMainLoop();

            Console.WriteLine("glutMainLoop() termination works fine!\n");
        }
        public static void Run()
        {
            string filePath         = Path.Combine("..", "..");
            string fileDirectory    = "Data";
            string vertexFileName   = "C3E4v_twist.cg";
            string fragmentFileName = "C2E2f_passthru.cg";

            if (File.Exists(vertexFileName))
            {
                filePath      = "";
                fileDirectory = "";
            }
            else if (File.Exists(Path.Combine(fileDirectory, vertexFileName)))
            {
                filePath = "";
            }

            string myVertexProgramFileName   = Path.Combine(Path.Combine(filePath, fileDirectory), vertexFileName);
            string myFragmentProgramFileName = Path.Combine(Path.Combine(filePath, fileDirectory), fragmentFileName);

            // Callback Delegates
            keyboardDelegate += keyboard;
            menuDelegate     += menu;
            idleDelegate     += idle;

            Glut.glutInitWindowSize(400, 400);
            Glut.glutInitDisplayMode(Glut.GLUT_RGB | Glut.GLUT_DOUBLE | Glut.GLUT_DEPTH);
            Glut.glutInit();

            Glut.glutCreateWindow(myProgramName);
            Glut.glutDisplayFunc(display);
            Glut.glutKeyboardFunc(keyboardDelegate);

            Gl.glClearColor(1.0f, 1.0f, 1.0f, 1.0f);  /* White background */

            myCgContext = Cg.cgCreateContext();
            checkForCgError("creating context");

            myCgVertexProfile = CgGl.cgGLGetLatestProfile(CgGl.CG_GL_VERTEX);
            CgGl.cgGLSetOptimalOptions(myCgVertexProfile);
            checkForCgError("selecting vertex profile");

            myCgVertexProgram =
                Cg.cgCreateProgramFromFile(
                    myCgContext,             /* Cg runtime context */
                    Cg.CG_SOURCE,            /* Program in human-readable form */
                    myVertexProgramFileName, /* Name of file containing program */
                    myCgVertexProfile,       /* Profile: OpenGL ARB vertex program */
                    myVertexProgramName,     /* Entry function name */
                    null);                   /* No extra compiler options */
            checkForCgError("creating vertex program from file");
            CgGl.cgGLLoadProgram(myCgVertexProgram);
            checkForCgError("loading vertex program");

            myCgVertexParam_twisting =
                Cg.cgGetNamedParameter(myCgVertexProgram, "twisting");
            checkForCgError("could not get twisting parameter");

            myCgFragmentProfile = CgGl.cgGLGetLatestProfile(CgGl.CG_GL_FRAGMENT);
            CgGl.cgGLSetOptimalOptions(myCgFragmentProfile);
            checkForCgError("selecting fragment profile");

            myCgFragmentProgram =
                Cg.cgCreateProgramFromFile(
                    myCgContext,               /* Cg runtime context */
                    Cg.CG_SOURCE,              /* Program in human-readable form */
                    myFragmentProgramFileName, /* Name of file containing program */
                    myCgFragmentProfile,       /* Profile: OpenGL ARB vertex program */
                    myFragmentProgramName,     /* Entry function name */
                    null);                     /* No extra compiler options */
            checkForCgError("creating fragment program from file");
            CgGl.cgGLLoadProgram(myCgFragmentProgram);
            checkForCgError("loading fragment program");

            /* No uniform fragment program parameters expected. */

            Glut.glutCreateMenu(menuDelegate);
            Glut.glutAddMenuEntry("[ ] Animate", ' ');
            Glut.glutAddMenuEntry("[w] Wireframe", 'w');
            Glut.glutAttachMenu(Glut.GLUT_RIGHT_BUTTON);

            // Change Animation to true, so that it starts with action ;-)
            keyboard((byte)' ', 0, 0);

            Glut.glutMainLoop();
        }