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

2018-12-19 Thread david crémoux
Then I would stay with the first solution I proposed, it will be more 
flexible in your case: regular text2dentity with custom frame graph 
branch and custom camera.


There is just one thing to be aware about the text2dentity, the entity 
doesn't do the rendering itself: it contains another entity which is 
taking card of the rendering (DistanceFieldTextRenderer).
So if you use a layer filter and attach it to the text2dentity, you 
should set it to be recursive to affect the rendering child entity.
Moreover this "rendering" entity set by default some render states, like 
the depth test, which may be boring to achieve the exact rendering you 
want (in my case it is ...).


david

On 19-Dec-18 11:14, Volker Enderlein wrote:
The number of Text2D elements is not known in advance and may differ. 
It's a simulation environment, where some textual information is added 
to a fairly high number of elements.
To avoid the data management for different kinds of entities my first 
idea was to create a specialized Text2d  entity that handles all the 
gory details in a custom material and provides an option to always face 
the camera.


Cheers Volker

Am 19.12.2018 um 08:37 schrieb david crémoux:

You're welcome.

I will most probably have to implement the same feature in a near 
future for the project I'm currently working on.


If making the custom camera is too much complex, there is a more basic 
way but involving more data management (depending on how much 2d text 
entities you have to display):
You still use a specific frame graph branch with a layer filter but 
with an identity camera.
Then you attach all your 2d text entities to your scene root entity 
and you update their transform/position on every camera transform/move.


david

On 19-Dec-18 10:05, Volker Enderlein wrote:

Hi David,

thanks for the answer. I wasn't thinking of that, as my knowledge 
about framegraphs is very limited. But this helps me further.


Cheers Volker

Am 18.12.2018 um 14:53 schrieb david crémoux:

Hello Volker,

I guess you can achieve it with regular QText2DEntity, with a 
specific frame graph branch in your rendering for your 2d text, a 
layer filter and a custom camera (based on your main camera).


david

On 18-Dec-18 14:37, Volker Enderlein wrote:

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@qt-project.org
https://lists.qt-project.org/listinfo/interest


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

2018-12-18 Thread david crémoux

You're welcome.

I will most probably have to implement the same feature in a near future 
for the project I'm currently working on.


If making the custom camera is too much complex, there is a more basic 
way but involving more data management (depending on how much 2d text 
entities you have to display):
You still use a specific frame graph branch with a layer filter but with 
an identity camera.
Then you attach all your 2d text entities to your scene root entity and 
you update their transform/position on every camera transform/move.


david

On 19-Dec-18 10:05, Volker Enderlein wrote:

Hi David,

thanks for the answer. I wasn't thinking of that, as my knowledge about 
framegraphs is very limited. But this helps me further.


Cheers Volker

Am 18.12.2018 um 14:53 schrieb david crémoux:

Hello Volker,

I guess you can achieve it with regular QText2DEntity, with a specific 
frame graph branch in your rendering for your 2d text, a layer filter 
and a custom camera (based on your main camera).


david

On 18-Dec-18 14:37, Volker Enderlein wrote:

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@qt-project.org
https://lists.qt-project.org/listinfo/interest


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

2018-12-18 Thread david crémoux

Hello Volker,

I guess you can achieve it with regular QText2DEntity, with a specific 
frame graph branch in your rendering for your 2d text, a layer filter 
and a custom camera (based on your main camera).


david

On 18-Dec-18 14:37, Volker Enderlein wrote:

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@qt-project.org
https://lists.qt-project.org/listinfo/interest


Re: [Interest] [Qt3D] any way to synchronize main thread with render thread ?

2018-01-17 Thread david crémoux

My mistake: I'm not on OnDemand render policy.

On 18.01.2018 10:04, david crémoux wrote:

Hello,

While using Qt3D I'm trying to separate as much as possible the scene, 
rendering, and render window/widget. I'm not using Qt3DWindow, I'm using 
my own widget/surface.


The thing is, when I'm deleting my widget, I'm not deleting everything 
like in Qt3DWindow (scene, rendering, aspect, etc.).
But even if I'm setting a null surface to the rendering before 
physically deleting my widget/surface, the surface is still in use in 
the rendering thread : it crashes (on swapBuffers).


Is there a way to synchronize/wait for next frame with the render thread 
so I can be sure that my widget/surface is not used anymore so I can 
delete it freely?


I'm using Qt 5.9.3, c++, no QML, and I set an OnDemand render policy.

regards,
david

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


[Interest] [Qt3D] any way to synchronize main thread with render thread ?

2018-01-17 Thread david crémoux

Hello,

While using Qt3D I'm trying to separate as much as possible the scene, 
rendering, and render window/widget. I'm not using Qt3DWindow, I'm using 
my own widget/surface.


The thing is, when I'm deleting my widget, I'm not deleting everything 
like in Qt3DWindow (scene, rendering, aspect, etc.).
But even if I'm setting a null surface to the rendering before 
physically deleting my widget/surface, the surface is still in use in 
the rendering thread : it crashes (on swapBuffers).


Is there a way to synchronize/wait for next frame with the render thread 
so I can be sure that my widget/surface is not used anymore so I can 
delete it freely?


I'm using Qt 5.9.3, c++, no QML, and I set an OnDemand render policy.

regards,
david
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] [Qt3D] 5.10.0 crash with OpenGL ES 2.0 on desktop

2017-12-18 Thread david crémoux


On 18.12.2017 13:44, Konstantin Tokarev wrote:



18.12.2017, 09:05, "david crémoux" <da...@adeko.com>:

Hello,

I have a crash when forcing to use opengl es on desktop for 5.10.0
version (via: QApplication::setAttribute(Qt::AA_UseOpenGLES)).
It comes from QT3D_UNIFORM_TYPE_IMPL (graphicscontext_p.h:366),
m_rawByteSize is set to 0.

Looking at the sources it seems that m_rawByteSize is never initialized
for opengl es 2.0 (for other api, it is correctly initialized in
programUniformsAndLocations).

Or am I doing something wrong?


Documentation says: "Forces the usage of OpenGL ES 2.0 or higher on
platforms that use dynamic loading of the OpenGL implementation"

AFAIK dynamic loading is used only on Windows with `-opengl dynamic`
configuration.

What platfrom are you using?


I'm using windows 10 with Qt 5.10 64 bits as precompiled dynamic 
libraries (the ones that come with maintenance tool).


I traced from where the crash is coming from using sources.
GraphicsHelperES2 is used during runtime to compile shaders so I expect 
OpenGL ES 2.0 (i.e.: angle) is indeed used.




regards,
david

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest



___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


[Interest] [Qt3D] 5.10.0 crash with OpenGL ES 2.0 on desktop

2017-12-17 Thread david crémoux

Hello,

I have a crash when forcing to use opengl es on desktop for 5.10.0 
version (via: QApplication::setAttribute(Qt::AA_UseOpenGLES)).
It comes from QT3D_UNIFORM_TYPE_IMPL (graphicscontext_p.h:366), 
m_rawByteSize is set to 0.


Looking at the sources it seems that m_rawByteSize is never initialized 
for opengl es 2.0 (for other api, it is correctly initialized in 
programUniformsAndLocations).


Or am I doing something wrong?

regards,
david

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest