If we are using the opengl renderer, we can access the opengl context directly and use it to draw our components. We have to wrap the gl calls into beginGL() and endGL() calls. Note that the upper left corner will be (0,0) (as opposed to OpenGL default where 0,0 is the lower left corner).
Example:

public class MYBackground extends MTComponent{
        public MYBackground(PApplet pApplet) {
            super(pApplet);
        }
 
        
        public void drawComponent(PGraphics g) {
            super.drawComponent(g);
 
            if (MT4jSettings.getInstance().isOpenGlMode()){
                GL gl = Tools3D.beginGL(getRenderer());
 
                //use opengl draw commands etc
                //gl....
 
                Tools3D.endGL(getRenderer());
            }
        }
    }
Powered by MediaWiki contact