Witam.
Przeszukałem już chyba całą sieć i niestety nie mogę znaleźć odpowiedzi na mój problem.

Mam wczytany z pliku teapot.x czajnik i chciałem do niego dołożyć teksturę z dowolnego pliku.
Poniżej wklejam listing mojego programu i proszę o POMOC ( wszystko pisane w C# ):

[code]using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

using Microsoft.DirectX;
using Microsoft.DirectX.Direct3D;

namespace WindowsApplication1
{
public partial class Form1 : Form
{
private Device device;
private CustomVertex.PositionColored[] color_square;
private Mesh mesh;

    float Angle = 0;

    public Form1()
    {
        InitializeComponent();
    }

    private void Form1_Load(object sender, EventArgs e)
    {
       // SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.Opaque, true);
        SetStyle(ControlStyles.AllPaintingInWmPaint, true);
        InitializeDirectX();
    }

    private void Form1_Paint(object sender, PaintEventArgs e)
    {            
        Render();
      //  Invalidate();
    }

    private void InitializeDirectX()
    {
        PresentParameters PP = new PresentParameters();

        PP.Windowed = true;
        PP.SwapEffect = SwapEffect.Discard;
        if (!PP.Windowed)
        {
            PP.FullScreenRefreshRateInHz = 60;
            PP.BackBufferWidth = 800;
            PP.BackBufferHeight = 600;
            PP.BackBufferCount = 1;
            PP.BackBufferFormat = Format.X8R8G8B8;
            PP.PresentFlag = PresentFlag.None;
        }
        device = new Device(0, DeviceType.Hardware, pictureBox1, CreateFlags.HardwareVertexProcessing, PP);

        InitializeScene();
    }

    private void InitializeScene()
    {

// mesh = Mesh.Sphere(device, 0.5f, 30, 30);
// mesh = Mesh.Torus(device, 0.3f, 0.6f, 30, 30);
mesh = Mesh.FromFile("teapot.x", MeshFlags.SystemMemory, device);
}

    public void Render()
    {
        Vector3 rot = new Vector3(0, 0, 0);

        device.Clear(ClearFlags.Target, Color.Black, 1.0f, 0);

        if (radioButton1.Checked)
            device.Transform.Projection = Matrix.PerspectiveFovLH(45.0f, 1.0f, 1.0f, 100f);
        if (radioButton2.Checked)
            device.Transform.Projection = Matrix.OrthoOffCenterLH(-2.0f, 2.0f, -2.0f, 2.0f, 1.0f, 250.0f);

        if (checkBox1.Checked)
            rot.X = 1f;
        else
            rot.X = 0f;
        if (checkBox2.Checked)
            rot.Y = 1f;
        else
            rot.Y = 0f;
        if (checkBox3.Checked)
            rot.Z = 1f;
        else
            rot.Z = 0f;

        device.Transform.World = Matrix.RotationAxis(rot, Angle);
        device.Transform.World *= Matrix.Translation(0f, 0f, 4f);
       
        device.RenderState.Lighting = false;
        device.RenderState.CullMode = Cull.None;

        device.BeginScene();
        
        //device.RenderState.FillMode = FillMode.WireFrame;
        device.RenderState.FillMode = FillMode.Point;

        mesh.DrawSubset(0);

        device.EndScene();
        device.Present();
    }

    private void timer1_Tick(object sender, EventArgs e)
    {
        Angle += 0.1f;
        Render();
    }

    private void label1_Click(object sender, EventArgs e)
    {
    }

    private void checkBox3_CheckedChanged(object sender, EventArgs e)
    {
    }

}

}[/code]

Proszę o odpowiedzi na maila [email protected]

Z góry dzięki.
Pozdrawiam.