smarrocco's picture

Direct GDI drawing into glcontrol possible without texturing?

I've seen the examples/posts regarding drawing text into a texture in opentk. I wished to try GDI+ drawing into a glcontrol as such (in vb.net)....

Private Sub GlControl1_Paint(sender As Object, e As PaintEventArgs) Handles GlControl1.Paint
        RedrawGL()
        Dim G As Drawing.Graphics = e.Graphics
        Dim NewFont As New System.Drawing.Font("Arial", 50, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        G.TextRenderingHint = Drawing.Text.TextRenderingHint.AntiAlias
        G.DrawString("GDI+ in OpenTK.", NewFont, Brushes.DarkBlue, 20, 20)
    End Sub

Although the text is rendered, the background is transparent (all the way through to the windows desktop). Is this method of drawing into the control supported?

Also, is it possible to obtain an instance of the Graphics class of the glControl from outside of a paint (or other glControl-based) event?