opcon / QuickFont

A Modern OpenGL Font Rendering Library for OpenTK
https://github.com/opcon/QuickFont
MIT License
83 stars 25 forks source link

How show graph and text on GLControl ? #53

Closed always0108 closed 3 years ago

always0108 commented 3 years ago

I want to show a rectangle and some text on a GLControl panel,but it doesn't work,the panel only show the text. What should I do to slove it?

`//图形 GL.Disable(EnableCap.Texture2D); GL.Color3(Color.Black); GL.Begin(BeginMode.LineLoop); GL.Vertex2(300, 100); GL.Vertex2(300, 50); GL.Vertex2(400, 50); GL.Vertex2(400, 100); GL.End();

qfont = new QFont("C:\Windows\Fonts\tahoma.ttf", 50, new QuickFont.Configuration.QFontBuilderConfiguration(true)); qdraw = new QFontDrawing(); qdraw.ProjectionMatrix = _projectionMatrix; QFontRenderOptions textOpts; textOpts = new QFontRenderOptions() { Colour = Color.Red, //Color.DarkRed, etc DropShadowActive = false }; qdraw.DrawingPrimitives.Clear(); qdraw.Print(qfont, "Hello world", new Vector3(100f,100f,0f), QFontAlignment.Left,textOpts); qdraw.RefreshBuffers(); qdraw.Draw(); //Add this qdraw.DisableShader();

glControl1.SwapBuffers();`

always0108 commented 3 years ago

I just solved it, after "qdraw.Draw();" should add "qdraw.DisableShader();".