Login  Register

Re: Looking for working Ardor3d example...

Posted by adanecito on May 05, 2014; 4:21pm
URL: https://forum.jogamp.org/Looking-for-working-Ardor3d-example-tp4032279p4032280.html

Hi All,

Thanks for any idea what I am doing wrong. I am using GLJPanel if that helps.


        public static void initializeArdorSystem(final DrawContext dc) {

                 if (ContextManager.getContextForKey("HACKED CONTEXT") != null) {
                JoglRenderContext rc = (JoglRenderContext) ContextManager.switchContext("HACKED CONTEXT");
                        return;
                }
                 
                if (_context == null) {

                        CapsUtil capsUtil = new CapsUtil();
                        _context = GLDrawableFactory.getFactory(capsUtil.getProfile())
                                        .createExternalGLContext();

                }
               
                final JoglContextCapabilities jcaps = new JoglContextCapabilities(
                                dc.getGL(), new DirectNioBuffersSet());
                final JoglRenderContext rc = new JoglRenderContext(_context,jcaps, null);
               
                 //final RenderContext rc = new RenderContext(dc.getGLContext(), jcaps);

                ContextManager.addContext("HACKED CONTEXT", rc);
                ContextManager.switchContext("HACKED CONTEXT");
               
                //ContextManager.addContext(CONTEXT_KEY, rc);
                //ContextManager.switchContext(CONTEXT_KEY);

                // disable Ardor3d's frustum culling, as we don't use Ardor3d's camera
                // system:
                Camera cam = new Camera() {
                        @Override
                        public FrustumIntersect contains(BoundingVolume bound) {
                                return FrustumIntersect.Inside;
                        }
                };
                ContextManager.getCurrentContext().setCurrentCamera(cam);
                AWTImageLoader.registerLoader();
        }