コード例 #1
0
        /*
         * Textures found at:
         * http://www.solarsystemscope.com/nexus/textures/planet_textures/
         */
        public RenderWindow(int width, int height, OpenTK.Graphics.GraphicsMode mode, string title) : base(width, height, mode, title)
        {
            physController  = new PhysicsController();
            camController   = new CameraController(new double[] { 0, 0.0f, -10000000 });//new double[] { -1000000.0f, 0.0f, -1000000.0f });
            graphController = new GraphicsController();
            graphController.ReadObjFile("sphere.obj");
            graphController.ReadSkyObjFile("skybox.obj");

            int[] newTextureIds = new int[8];
            GL.GenTextures(8, newTextureIds);
            newTextureIds[0] = graphController.LoadTexture("Textures/texture_sun.jpg");
            newTextureIds[1] = graphController.LoadTexture("Textures/texture_earth_clouds.jpg");
            newTextureIds[2] = graphController.LoadTexture("Textures/texture_mercury.jpg");
            newTextureIds[3] = graphController.LoadTexture("Textures/texture_venus_surface.jpg");
            newTextureIds[4] = graphController.LoadTexture("Textures/texture_mars.jpg");
            newTextureIds[5] = graphController.LoadTexture("Textures/texture_jupiter.jpg");
            newTextureIds[6] = graphController.LoadTexture("Textures/texture_saturn.jpg");
            newTextureIds[7] = graphController.LoadTexture("Textures/texture_moon.jpg");

            skyboxTextureId = graphController.LoadTexture("Textures/texture_skybox.jpg");
            textureIds      = newTextureIds;

            // Skybox
            double[] skyboxPos = new double[] { (float)-Math.Pow(10, 11) / 2, (float)-Math.Pow(10, 11) / 2, (float)-Math.Pow(10, 11) / 2 };
            skybox = new SimObject(skyboxPos, new PhysicsObject(), graphController.CreateSkyboxObj(1));
        }