示例#1
0
        void initProgram()
        {
            lastMousePos         = new Vector2(Mouse.X, Mouse.Y);
            CursorVisible        = false;
            cam.MouseSensitivity = 0.0025f;

            GL.GenBuffers(1, out ibo_elements);

            // Load shaders from file
            shaders.Add("default", new ShaderProgram("vs.glsl", "fs.glsl", true));
            shaders.Add("textured", new ShaderProgram("vs_tex.glsl", "fs_tex.glsl", true));

            activeShader = "textured";

            // Load textures from file
            textures.Add("opentksquare.png", loadImage("opentksquare.png"));
            textures.Add("opentksquare2.png", loadImage("opentksquare2.png"));

            // Create our objects
            TexturedCube tc = new TexturedCube();

            tc.TextureID = textures["opentksquare.png"];
            objects.Add(tc);

            TexturedCube tc2 = new TexturedCube();

            tc2.Position += new Vector3(1f, 1f, 1f);
            tc2.TextureID = textures["opentksquare2.png"];
            objects.Add(tc2);

            // OBJ models from files
            ObjVolume obj1 = ObjVolume.LoadFromFile("teapot.obj");

            obj1.TextureID = textures["opentksquare.png"];
            objects.Add(obj1);

            ObjVolume obj2 = ObjVolume.LoadFromFile("teapot.obj");

            obj2.TextureID = textures["opentksquare.png"];
            obj2.Position += new Vector3(0, 2f, 0);
            objects.Add(obj2);

            // Move camera away from origin
            cam.Position += new Vector3(0f, 0f, 3f);
        }
示例#2
0
        void initProgram()
        {
            lastMousePos = new Vector2(Mouse.X, Mouse.Y);

            GL.GenBuffers(1, out ibo_elements);

            // Load shaders from file
            shaders.Add("default", new ShaderProgram("vs.glsl", "fs.glsl", true));
            shaders.Add("textured", new ShaderProgram("vs_tex.glsl", "fs_tex.glsl", true));

            activeShader = "textured";

            // Load textures from file
            textures.Add("opentksquare.png", loadImage("opentksquare.png"));
            textures.Add("opentksquare2.png", loadImage("opentksquare2.png"));

            // Create our objects
            TexturedCube tc = new TexturedCube();
            tc.TextureID = textures["opentksquare.png"];
            objects.Add(tc);

            TexturedCube tc2 = new TexturedCube();
            tc2.Position += new Vector3(1f, 1f, 1f);
            tc2.TextureID = textures["opentksquare2.png"];
            objects.Add(tc2);

            // OBJ models from files
            ObjVolume obj1 = ObjVolume.LoadFromFile("cow.obj");
            obj1.TextureID = textures["opentksquare.png"];
            objects.Add(obj1);

            ObjVolume obj2 = ObjVolume.LoadFromFile("teapot.obj");
            obj2.TextureID = textures["opentksquare.png"];
            obj2.Position += new Vector3(0, 2f, 0);
            objects.Add(obj2);

            // Move camera away from origin
            cam.Position += new Vector3(0f, 0f, 3f);
        }