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();
}