[Interest] Qt3D How to draw 2D-Text always facing the Camera

Philip Schuchardt vpicaver at gmail.com
Tue Dec 18 22:11:33 CET 2018


If you rendering in QtQuick you can use a Text{} item and project it's
position into screen space.

On Tue, Dec 18, 2018 at 10:46 AM Volker Enderlein <
volker.enderlein at ifm-chemnitz.de> wrote:

> Hi Oleg,
>
> thank you so much for your comment. I saw your entry in the bug tracker
> and therefore I tried to go the way with the custom material.
> Unfortunately I cannot access the underlying material definition of the
> utility classes that are used to render the text in Text2DEntity. As
> they are all private and not exported from Qt DLLs I would need to copy
> them, but that's something I would really try to avoid. The custom
> material part was straight forward, based on your bug report and on a
> previous implementation of a specialized material definition.
> But now I'm stuck with the missing access.
>
> Cheers Volker
>
> Am 18.12.2018 um 13:38 schrieb Oleg Evseev:
> > Hi Volker,
> >
> > Yes, you have to add custom material because
> > Qt3DRender::QShaderProgram s of default materials are inside private
> > class, so you can't change shaders' code source.
> >
> > Take a look at https://codereview.qt-project.org/#/c/182053/ (that was
> > for including in qt 3d, but you could easily use it as custom material
> > in your own app) and adopt it accordingly to Text2DMaterial.
> >
> > ---
> > With regards, Oleg
> >
> > вт, 18 дек. 2018 г. в 15:07, Volker Enderlein
> > <volker.enderlein at ifm-chemnitz.de
> > <mailto:volker.enderlein at ifm-chemnitz.de>>:
> >
> >     Hi all,
> >
> >     when building a rather complex Qt3D-Scene I needed some 2D-Text
> >     that has
> >     a 3D position, is always facing the camera, and fixed in size,
> >     independent of the camera settings.
> >
> >     While looking over the components provided by Qt3D I stumbled across
> >     Text2DEntity and thought about how it can be tweaked ot fulfill my
> >     requirements.
> >
> >     As all my requirements can be done inside a shader I thought about
> >     whether the QText2DMaterial that is used inside the class can be
> >     replaced by a custom material. But unfortunately the material is not
> >     accessible from outside.
> >
> >     Text2DEntity can be embedded in another class that applies the camera
> >     information to it, but is there an easier solution to this problem?
> >
> >     Cheers Volker
> >
> >     --
> >
> >     _______________________________________________
> >     Interest mailing list
> >     Interest at qt-project.org <mailto:Interest at qt-project.org>
> >     https://lists.qt-project.org/listinfo/interest
> >
>
> --
>
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> https://lists.qt-project.org/listinfo/interest
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20181218/90f17cb5/attachment.html>


More information about the Interest mailing list