Closed ZacZhangzhuo closed 10 months ago
Context to your problem and fonts in OpenGL
The issue with the text is that it is displayed through shader as a glyph (simple texture, more about this: https://learnopengl.com/In-Practice/Text-Rendering): https://github.com/compas-dev/compas_view2/blob/6a9d915507652e62db77372c9b55be9f00a0e8bd/src/compas_view2/objects/textobject.py#L52
How to change the font?
For now, I think you can only change the font:
Font orientation
For text orientation, you need to modify vertex shader, which means it is makes sense to have 2 shaders one for camera facing text and another for user given orientation:
https://github.com/compas-dev/compas_view2/blob/main/src/compas_view2/shaders/120/text.vert
In the line 15 you can see that it takes transformation matrices from python code to OpenGL.
If you have time, I suggest to try it yourself, making shaders, is an interesting thing to learn about computer graphics. I do not know if @Licini has currently time for it :)
Thanks for the very cool and detailed explanation!
Surely I am happy to look at the source code and try to modify it! I will also very look forward to the official update about it!
sloved by #170
Feature Request
COPY OF: https://forum.compas-framework.org/t/font-and-style-setting-for-text/721
As a user, I want the Text object to be customizable in font and style.
Details
screen size
andspace size
. I imagined we can have a fixed text size compared to the space, so it gets smaller when we zoom out.always facing the screen
tofixed orientation
.Hope they can be improved!