Why can't I draw GL graphics in Editor Window without needing to call some GUI function first ?

Hi guys, I can draw GL graphics in my editor window but the drawing only happens one I call a GUI function before it.
How can draw GL stuff without having to call some GUI function first ?

Note: all of this take place in an Editor Window

void OnGUI()
{
GUI.Box(new Rect(),""); // unless we draw some GUI , the GL graphics in the next function wont be drawn... why ?
GLTexture(new Rect(0,0,100,100), Color.red);
}
       public static void GLTexture(Rect rect, Color color)
        {

            GL.PushMatrix();
            GL.LoadPixelMatrix();
            GL.Begin(GL.QUADS);
            GL.Color(color *4);
            GL.Vertex3(rect.x, rect.y, 0);
            GL.Vertex3(rect.x, rect.y + rect.height, 0);
            GL.Vertex3(rect.x + rect.width, rect.y + rect.height, 0);
            GL.Vertex3(rect.x + rect.width, rect.y, 0);
            GL.End();
            GL.PopMatrix();
        }

You haven’t activated any shader pass before your drawing. You need a material and call SetPass. See the example in the docs.

In addition you have to restrict rendering to the Repaint event. You shouldn’t draw anything if the event is not Repaint.

If (Event.current.type == EventType.Repaint)
{
    // do your drawing here
}