jagarciauceda's picture

QuickFont Problem

I have this problem. I draw a simple square in opentk, no problem. but when a I use the quickFont and when I want to draw the square....the square is there but suddenly has not intensity. You need to see very near to screen to see that the square is there.

Here the code. (I am new) THANks in advance!!

public Program()
{
Size = new Size(1200, 800);
GL.LineWidth(2f);
}

protected override void OnResize(EventArgs e)
{
// Set orthographic rendering (useful when you want 2D)
GL.MatrixMode(MatrixMode.Projection);
GL.LoadIdentity();
GL.Ortho(this.ClientRectangle.Left, this.ClientRectangle.Right,
this.ClientRectangle.Bottom, this.ClientRectangle.Top, -1.0, 1.0);
GL.Viewport(this.ClientRectangle.Size);

//esto es el background
GL.ClearColor(Color.Turquoise);

//cargamos las fuentes
heading1 = new QFont("HappySans.ttf", 72);

}

protected override void OnRenderFrame(FrameEventArgs e)
{
//if (time == 0f)
GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);

GL.MatrixMode(MatrixMode.Modelview);
GL.LoadIdentity();

text();

// Draw box
GL.Color3(Color.White);
Shapes.DrawBox(100f, 100f, 200f);

SwapBuffers();
}

private void text()
{

QFont.Begin();
GL.Translate(250f, 0f, 0f);
heading1.Print("123456");
QFont.End();

}


Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
the Fiddler's picture

I don't know how QuickFont works, but it is probably setting some state but not clearing it when it's done. My guess would be alpha blending.

Since you are using OpenGL 1.x, try surrounding QFont with a call to GL.PushAttrib(AllAttribsBit) and GL.PopAttrib().