473,394 Members | 1,802 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

3D Triangle ImageBrush - WPF

Hi. I am trying to apply an image brush to a 3d triangle without success: My code is below. What am i foing wrong?

Expand|Select|Wrap|Line Numbers
  1.     Dim ModelTri As New MeshGeometry3D
  2.     ModelTri.Positions.Add(New Point3D(0, 0, 0))
  3.     ModelTri.Positions.Add(New Point3D(100, 0, 0))
  4.     ModelTri.Positions.Add(New Point3D(100, 100, 0))
  5.  
  6.     Dim MeshTri As New MeshGeometry3D
  7.     MeshTri.TriangleIndices.Add(0)
  8.     MeshTri.TriangleIndices.Add(1)
  9.     MeshTri.TriangleIndices.Add(2)
  10.  
  11.     'Texture
  12.     Dim TexturePoints As New PointCollection
  13.     TexturePoints.Add(New Point(100, 0))
  14.     TexturePoints.Add(New Point(0, 100))
  15.     TexturePoints.Add(New Point(100, 100))
  16.     MeshTri.TextureCoordinates = TexturePoints
  17.  
  18.     'Image Brush
  19.     Dim imgBrush As New ImageBrush()
  20.     imgBrush.ImageSource = New BitmapImage(New Uri("Mercury.jpg", UriKind.Relative))
  21.     imgBrush.Stretch = Stretch.Fill
  22.     imgBrush.TileMode = TileMode.Tile
  23.     imgBrush.SetValue(NameProperty, "imgBrush")
  24.     Dim Mat As Material
  25.     Dim DMaterial As New DiffuseMaterial
  26.     DMaterial.Brush = imgBrush
  27.  
  28.     Dim Bind As New Binding("imgBrush")
  29.     Bind.Source = imgBrush
  30.     BindingOperations.SetBinding(DMaterial, BindingGroupProperty, Bind)
  31.  
  32.     'This doesnt work
  33.     Mat = DMaterial
  34.  
  35.     'This works
  36.     'Mat = New DiffuseMaterial(New SolidColorBrush(Colors.Khaki))
  37.  
  38.     Dim triangleModel As GeometryModel3D = New GeometryModel3D(ModelTri, Mat)
  39.  
  40.     Dim model As New ModelVisual3D()
  41.     model.Content = triangleModel
  42.  
  43.     Viewport.Children.Add(model)
  44.  
Mar 24 '10 #1
0 1705

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: coinjo | last post by:
I need to write a program, which takes two inputs: •a value n that represents the number of elementsin the longest row of a triangle. •a character c to be printed in place of each...
16
by: VISHNU VARDHAN REDDY UNDYALA | last post by:
Hi, Could anyone over here, write a program in C using only for loop to print the following output * *** ***** ******* ********* ***********
2
by: javadkhan | last post by:
Hi All, I am trying to supress the small black triangle that shows up in the menus meaning the menuitem is parent. The reason for that is I drew my own 3D looking triangle in DrawItem using...
1
by: Leo | last post by:
Can someone tell me how to make the sorting triangle on datagrid column header always show up? And which property can change the color of the triangle ? The default color is white. Thanks
5
by: singhm | last post by:
Hi guys so I have a trianlge program having hard time finishing this though, I have to develop a program which is the following: Write a program that will allow the user to enter the 3 lengths...
0
geo039
by: geo039 | last post by:
I have a program that takes user input from a textbox. Based on those 3 numbers it will tell them whether it is a right triangle, equilateral triangle or not a triangle. I've written 3 constructors...
19
by: lost1 | last post by:
Can someone point me in the right direction on how to get the triangle type to display. Below is a triangle class that is tested by another completely separate class. The main method of the test...
6
by: jackj | last post by:
Hi, I am first time C++ student and doing the usual tasks. This one is to create a triangle based on user input of how large (how many rows) and what symbol to use. I have managed to create a...
2
by: nuimstudent | last post by:
Hey, I have to write a code which calculates pascals triangle using C. So Far I have the triangle with a right side allignment. As part of the assignment, we actually have to get the triangle to...
1
by: musicmaster890 | last post by:
I'm trying to use the ImageBrush brush in a rectangle to make a picture slideshow in Silverlight, but I'm getting this error everytime I try: Silverlight Error Message ErrorCode: 3002 ErrorType:...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.