简体   繁体   English

HoloLens DirectX C#应用程序:是否可以在平板上显示一些文本?

[英]HoloLens DirectX C# app: Is it possible to show some text on the slate?

I've created my HoloLens application from the "Holographic DirectX 11 App (Universal Windows)" template. 我已经从“ Holographic DirectX 11 App(Universal Windows)”模板创建了HoloLens应用程序。 When I start the app, it shows a slate (a 2D window) in the HoloLens and I need to place it in the space. 启动应用程序时,它会在HoloLens中显示一个平板(一个2D窗口),我需要将其放置在空间中。 Then my app will work as a hologram (in an immersive view). 然后,我的应用程序将作为全息图工作(在沉浸式视图中)。

Before going to the immersive view, I want to check some conditions and show a message to the user, if the application cannot start. 如果无法启动应用程序,在进入沉浸式视图之前,我想检查一些条件并向用户显示一条消息。

Currently, my app does not have any XAML code. 目前,我的应用程序没有任何XAML代码。

It uses SharpDX library. 它使用SharpDX库。

Can I write some text on the slate window? 我可以在平板视窗上写一些文字吗?

I understand that this is an old question, but I will answer just in case somebody else needs to do something similar. 我知道这是一个古老的问题,但是我会回答,以防其他人需要做类似的事情。

There are two possible ways to do that: 有两种可能的方法:

1) Perhaps the easiest way is to start your app as a XAML app and then, if everything is alright, to switch to DirectX mode, otherwise write your message on the main XAML window of the app. 1)也许最简单的方法是将您的应用程序作为XAML应用程序启动,然后,如果一切正常,则切换到DirectX模式,否则将消息写在该应用程序的主XAML窗口中。 You could also provide a "Go Holographic" button for the user. 您还可以为用户提供“转到全息图”按钮。 There is a very good blog post here by Jonathan Antoine, which explains how to perform the switch between XAML and Holographic mode in detail- it also provides the source code 乔纳森·安托万(Jonathan Antoine) 在这里有一篇很好的博客文章,其中详细解释了如何在XAML和全息模式之间进行切换-它还提供了源代码。

2) Another solution is to write your text to a DirectX texture and then paint that texture onto a rectangle in the 3D immersive mode. 2)另一个解决方案是将文本写入DirectX纹理,然后在3D沉浸模式下将该纹理绘制到矩形上。 But that one is probably not exactly what you want since you'll need to switch to Holographic mode first and it is a fair amount of work 但这可能不完全是您想要的,因为您需要先切换到全息模式,这需要大量工作

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM