Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. .NET (Core and Framework)
  4. WPF, Textures and large images

WPF, Textures and large images

Scheduled Pinned Locked Moved .NET (Core and Framework)
csharpwpfhelpquestion
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    Robert Rohde
    wrote on last edited by
    #1

    Hi, I just started playing around with the 3D functionalities in WPF and have a problem now: I have a ViewPort3D to which I added a cube. To one side of this cube I have applied a material like this:

    MeshGeometry3D plane = new MeshGeometry3D();
    Point3DCollection points = new Point3DCollection();
    points.Add(new Point3D(p1X, p1Y, p1Z));
    points.Add(new Point3D(p2X, p2Y, p2Z));
    points.Add(new Point3D(p3X, p3Y, p3Z));
    points.Add(new Point3D(p4X, p4Y, p4Z));
    plane.Positions = points;
    Int32Collection indices = new Int32Collection();
    indices.Add(0);
    indices.Add(1);
    indices.Add(2);
    indices.Add(0);
    indices.Add(2);
    indices.Add(3);
    plane.TriangleIndices = indices;
    PointCollection texturePoints = new PointCollection();
    texturePoints.Add(new Point(0, 0));
    texturePoints.Add(new Point(0, 1));
    texturePoints.Add(new Point(1, 1));
    texturePoints.Add(new Point(1, 0));
    plane.TextureCoordinates = texturePoints;

    ImageBrush brush = new ImageBrush();
    brush.ImageSource = new BitmapImage(new Uri(@"C:\test1.jpg"));
    DiffuseMaterial material = new DiffuseMaterial(brush);

    GeometryModel3D result = new GeometryModel3D(plane, material);

    Everything work fine with "small" images. I have a supa dupa cube with a clear texture. But if I use images where the width or height has more than 2000 pixels than I see a weird tiled result on my cube. Has anyone here had any problems with large images in 3D WPF? Any hints are appreciated. Robert

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups