我有一个正交视图(翻转180度),其中包含在OpenTK中使用QuickFont编写的一些文本。我想翻看文字,所以我想为QFontBuilderConfiguration.TransformToCurrentOrthogProjection
设置TransformViewport
和QFontRenderOptions
,但它不起作用。以下是我的代码 -
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);
}
最后输出应该是翻转文本。
答案 0 :(得分:0)
我认为当你打开" TransformToCurrentOrthogProjection"选项,QuickFont只需将字体缩放到当前投影,当你想要的是旋转时,请尝试:
GL.Rotate(180, 0, 0, 1);