Reputation: 6338
I have an orthogonal view (which is flipped 180 degree) containing some text written using QuickFont in OpenTK. I wanted to flip the text so I thought of setting QFontBuilderConfiguration.TransformToCurrentOrthogProjection
and TransformViewport
for QFontRenderOptions
but its not working. 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.
Upvotes: 2
Views: 1202
Reputation: 1814
I think when you turn on the "TransformToCurrentOrthogProjection" option, QuickFont simply scales the font to the current projection, when what you want is a rotation, so try:
GL.Rotate(180, 0, 0, 1);
Upvotes: 1