[英]3d object not rendered
I have a WPF application that has a main window. 我有一个WPF应用程序,它有一个主窗口。 In that I have a frame, the frame content is a page.
因为我有一个框架,框架内容是一个页面。
Now in page is 4 viewport3D that contain Viewport2DVisual3D and in that I have image element. 现在页面是包含Viewport2DVisual3D的4 viewport3D,并且我有图像元素。
Problem : on some PCs my application runs well but on some PCs my application doesn't render viewport3d or it doesn't render the frame. 问题:在某些PC上我的应用程序运行良好但在某些PC上我的应用程序不呈现viewport3d或它不呈现帧。 Dunno but it doesn't show anything in main window.
Dunno但它在主窗口中没有显示任何内容。
The problem occurs on an Acer laptop Model . 问题发生在Acer笔记本电脑型号上 。
Rendered : 呈现:
Not Rendered : 未呈现:
EDIT: This issue occurred again when I placed the frame in a grid. 编辑:当我将框架放在网格中时,再次出现此问题。 (I show this page in a frame, that frame is the main content of my window: when I place the frame in a grid it didn't show objects) Seems This Occure on laptop with shared graphics
(我在一个框架中显示此页面,该框架是我的窗口的主要内容:当我将框架放置在网格中时,它没有显示对象)似乎在带有共享图形的笔记本电脑上的这个Occure
EDIT 2: 编辑2:
<Page x:Class="MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Loaded="Page_Loaded_1"
x:Name="myMainPage" FlowDirection="RightToLeft" >
<Page.Resources>
<Style TargetType="ContentControl" x:Key="MenuItemsStyle">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate>
<Viewport3D VerticalAlignment="Stretch" HorizontalAlignment="Stretch" ClipToBounds="False">
<Viewport3D.Camera>
<PerspectiveCamera x:Name="myCam" FieldOfView="90" Position="{Binding ElementName=myMainWindow, Path=CameraHeight}" NearPlaneDistance="1" FarPlaneDistance="10"/>
</Viewport3D.Camera>
<ModelVisual3D>
<ModelVisual3D.Content>
<Model3DGroup>
<DirectionalLight Color="#FFFFFFFF" Direction="0,0,-1"/>
</Model3DGroup>
</ModelVisual3D.Content>
</ModelVisual3D>
<Viewport2DVisual3D x:Name="V2d3d">
<Viewport2DVisual3D.Transform>
<Transform3DGroup>
<RotateTransform3D >
<RotateTransform3D.Rotation>
<AxisAngleRotation3D Axis="0,1,0" Angle="0" x:Name="aar3D"/>
</RotateTransform3D.Rotation>
</RotateTransform3D>
</Transform3DGroup>
</Viewport2DVisual3D.Transform>
<Viewport2DVisual3D.Material>
<DiffuseMaterial Viewport2DVisual3D.IsVisualHostMaterial="True" Brush="White"/>
</Viewport2DVisual3D.Material>
<Viewport2DVisual3D.Geometry>
<MeshGeometry3D Positions="{Binding ElementName=myMainWindow, Path=MeshPosions}"
TextureCoordinates="0,0 0,1 1,1 1,0" TriangleIndices="0 1 2 0 2 3"/>
</Viewport2DVisual3D.Geometry>
<Border Name="mainBorder" VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
<Border.Style>
<Style TargetType="Border">
<Setter Property="BorderThickness" Value="1.2"/>
<Setter Property="Background" >
<Setter.Value>
<SolidColorBrush Color="Transparent"/>
</Setter.Value>
</Setter>
<Setter Property="BorderBrush" >
<Setter.Value>
<SolidColorBrush Color="Transparent"/>
</Setter.Value>
</Setter>
</Style>
</Border.Style>
<ContentPresenter VerticalAlignment="Stretch" HorizontalAlignment="Stretch"
Content="{TemplateBinding ContentControl.Content}">
<ContentPresenter.Triggers>
<EventTrigger RoutedEvent="ContentPresenter.MouseLeftButtonDown">
// Axis Animation
</EventTrigger>
</ContentPresenter.Triggers>
</ContentPresenter>
</Border>
</Viewport2DVisual3D>
</Viewport3D>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<EventTrigger RoutedEvent="ContentControl.MouseLeftButtonDown" >
//Axis Animation
</EventTrigger>
<EventTrigger RoutedEvent="ContentControl.MouseEnter">
//ScaleAnimation
</EventTrigger>
<EventTrigger RoutedEvent="ContentControl.MouseLeave">
//ScaleAnimation
</EventTrigger>
</Style.Triggers>
</Style>
</Page.Resources>
<Page.Triggers>
<EventTrigger RoutedEvent="Loaded">
//Load Object Scale And Fade In
</EventTrigger>
</Page.Triggers>
<Grid Name="MainGrid">
<Canvas Name="MainCanvas" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" FlowDirection="LeftToRight">
<ContentControl Opacity="0" Name="MenuItem1" Style="{StaticResource MenuItemsStyle}"
MouseDown="MenuItem1_MouseDown" Panel.ZIndex="1" >
<Image Source="/IsargaranProject;component/Images/isargari.jpg"/>
<ContentControl.RenderTransform>
<ScaleTransform ScaleX="0.7" ScaleY="0.7" x:Name="MenuItem1ST"/>
</ContentControl.RenderTransform>
</ContentControl>
</Canvas>
</Grid>
</Page>
如果您正在使用OPENGL或DirectX3D,那么看到没有渲染的笔记本电脑,将会有一些像DirectX 3D一样的缺失插件,或者OpenGL你可以试试这两个3D渲染工具。我试过这个在过去我做了一个Graph程序它有同样的问题,但当我安装OPENGL和DirectX3D它工作正常!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.