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).

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