Esempio n. 1
0
        private void openGLControl1_Load(object sender, EventArgs e)
        {
            program = new ProgramObject(
               new VertexShader(Shaders.VERTEX_SHADER_TEXTURE),
                   new FragmentShader(Shaders.FRAGMENT_SHADER_ILLUMINATION));

            cylinder = new Cylinder(1, 4, 100, new Vector4(), program);

            cylinder.transformation = Matrix4.CreateTranslation(0, 0, -2);

            Light light = new Light(new Spherical(5, MathHelper.PiOver2, 0));

            foot = new Foot(2f, 20, program);
            foot.colored = false;
            foot.light = light;

            cover = new Cover(0.25f, 1, program);
            cover.noise_texture = true;
            cover.colored = false;
            cover.light = light;

            foot.transformation = Matrix4.CreateTranslation(0, 0, -1);
            cover.transformation = Matrix4.CreateTranslation(0, 0, -1);

            LoadImageTexture.LoadTexture(@"..\..\texture.jpg");

            openGLControl1.objects.Add(foot);
            openGLControl1.objects.Add(cover);

            openGLControl1.light = light;

            openGLControl1.load();
        }
Esempio n. 2
0
        private void OpenGLcontrol_load(object sender, EventArgs e)
        {
            ProgramObject program = new ProgramObject(
                new VertexShader(Shaders.VERTEX_TRANSFORMATION_SHADER),
                    new FragmentShader(Shaders.DEFAULT_FRAGMENT_SHADER));

            Foot foot = new Foot(2f, 20, program);
            Cover cover = new Cover(0.5f, 1, program);

            openGLControl1.objects.Add(foot);
            openGLControl1.objects.Add(cover);

            foot.transformation = Matrix4.CreateTranslation(0, 0,-1);
            cover.transformation = Matrix4.CreateTranslation(0, 0, -1);

            foot.wire_mode = true;
            cover.wire_mode = true;

            openGLControl1.load();
        }
Esempio n. 3
0
File: Lab8.cs Progetto: GNZ/CG
        private void openGLControl1_Load(object sender, EventArgs e)
        {
            ProgramObject program = new ProgramObject(
                new VertexShader(Shaders.VERTEX_SHADER_TEXTURE),
                    new FragmentShader(Shaders.FRAGMENT_SHADER_ILLUMINATION));

            // Constants
            int num = 10;
            float radius = 1.0f;
            float height = radius * 4f;
            cylinder = new Cylinder(radius, height, num, new Vector4(0, 1f, 0, 1f), program);
            //cylinder.colored = false;

            cover = new Cover(0.5f,10f,20f,0.5f, 5, program);
            cover.colored = false;

            foot = new Foot(2f, 20, program);
            foot.colored = true;

            /*** 3D AXES ***/

            /* X */
            cone_x = new Cone(0.1f, 0.2f, 10, new Vector4(1, 0, 0, 1f), program);
            cone_x.transformation = Matrix4.CreateRotationY((float)Math.PI / 2);
            cone_x.transformation *= Matrix4.CreateTranslation(1f, 0f, 0f);
            x_axis = new Cylinder(0.05f, 1f,  10,new Vector4(1, 0, 0, 1f), program);
            x_axis.transformation = Matrix4.CreateRotationY((float)Math.PI / 2);

            /* Y */
            cone_y = new Cone(0.1f, 0.2f, 10, new Vector4(0, 1f, 0, 1f), program);
            cone_y.transformation = Matrix4.CreateRotationX((float)-Math.PI / 2);
            cone_y.transformation *= Matrix4.CreateTranslation(0f, 1f, 0f);
            y_axis = new Cylinder(0.05f, 1f, 10, new Vector4(0, 1f, 0, 1f), program);
            y_axis.transformation = Matrix4.CreateRotationX((float)-Math.PI / 2);

            /* Z */
            cone_z = new Cone(0.1f, 0.2f, 10, new Vector4(0, 0, 1f, 1f), program);
            cone_z.transformation = Matrix4.CreateTranslation(0f, 0f, 1f);

            z_axis = new Cylinder(0.05f, 1f, 10, new Vector4(0, 0, 1f, 1f), program);

            /**************/
            floor = new Cylinder(100f, 0.1f, 4,new Vector4(0.5f, 0.5f, 0.5f, 1f), program);

            // Load texture
            Utilities.LoadImageTexture.LoadTexture(@"..\..\texture.jpg");

            // Add the objects to the selector
            objectSelector1.AddObject(cone_x);
            objectSelector1.AddObject(cone_y);
            objectSelector1.AddObject(cone_z);
            objectSelector1.AddObject(x_axis);
            objectSelector1.AddObject(y_axis);
            objectSelector1.AddObject(z_axis);
            objectSelector1.AddObject(foot);
            objectSelector1.AddObject(cover);
            objectSelector1.AddObject(cylinder);
            objectSelector1.AddObject(floor);

            objectSelector1.open_gl_control = openGLControl1;

            objectSelector1.SelectedIndices.Add(6);
            objectSelector1.SelectedIndices.Add(7);
            objectSelector1.SelectedIndices.Add(9);

            openGLControl1.load();
        }
Esempio n. 4
0
        private void openGLControl1_Load(object sender, EventArgs e)
        {
            program = new ProgramObject(
               new VertexShader(Shaders.VERTEX_SHADER_TEXTURE),
                   new FragmentShader(Shaders.FRAGMENT_SHADER_TEXTURE));

            cylinder = new Cylinder(1, 4, 100, new Vector4(), program);

            cylinder.transformation = Matrix4.CreateTranslation(0, 0, -2);

            foot = new Foot(2f, 20, program);
            cover = new Cover(0.25f, 1, program);

            foot.transformation = Matrix4.CreateTranslation(0, 0, -1);
            cover.transformation = Matrix4.CreateTranslation(0, 0, -1);

            LoadImageTexture.LoadTexture(@"..\..\texture.jpg");

            openGLControl1.objects.Add(foot);
            openGLControl1.objects.Add(cover);

            openGLControl1.load();
        }