[英]How to flip QuickFont in OpenTK
I have an orthogonal view (which is flipped 180 degree) containing some text written using QuickFont in OpenTK. 我有一个正交视图(翻转了180度),其中包含一些在OpenTK中使用QuickFont编写的文本。 I wanted to flip the text so I thought of setting
QFontBuilderConfiguration.TransformToCurrentOrthogProjection
and TransformViewport
for QFontRenderOptions
but its not working. 我想翻转文本,所以我想设置的
QFontBuilderConfiguration.TransformToCurrentOrthogProjection
和TransformViewport
为QFontRenderOptions
但它不工作。 Following is my code- 以下是我的代码-
const float LeftX = 0.0f;
const float RightX = 16.0f;
const float BottomY = 12.0f;
const float TopY = 0.0f;
const float FarZ = 1.0f;
const float NearZ = -1.0f;
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
QFontBuilderConfiguration fontBuilderConfiguration = new QFontBuilderConfiguration();
fontBuilderConfiguration.TransformToCurrentOrthogProjection = true; // Adding this throwing error
font = new QFont("Fonts/HappySans.ttf", 30, fontBuilderConfiguration);
QFontRenderOptions fontRenderOptions = new QFontRenderOptions();
fontRenderOptions.TransformToViewport = new TransformViewport(0, 0, RightX, BottomY);
font.PushOptions(fontRenderOptions);
GL.ClearColor(Color.AliceBlue);
GL.Disable(EnableCap.DepthTest);
}
protected override void OnResize(EventArgs e)
{
base.OnResize(e);
GL.Viewport(0, 0, Width, Height);
GL.MatrixMode(MatrixMode.Projection);
GL.LoadIdentity();
GL.Ortho(RightX, LeftX, TopY, BottomY, FarZ, NearZ);
}
Finally the output should be flipped text. 最后,输出应为翻转文本。
我想当您打开“ TransformToCurrentOrthogProjection”选项时,如果需要旋转 ,QuickFont会简单地将字体缩放到当前投影,因此请尝试:
GL.Rotate(180, 0, 0, 1);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.