Examples of GLDrawableFactory


Examples of javax.media.opengl.GLDrawableFactory

    }
   
    /* create GL canvas and set rendering parameters */

    GLProfile profile = GLProfile.getDefault();
    GLDrawableFactory factory = GLDrawableFactory.getFactory(profile);
   
    if (! factory.canCreateGLPbuffer(null, profile)) {
      throw new Error("Cannot create GLPbuffer for OpenGL output!");
    }
   
    GLCapabilities cap = new GLCapabilities(profile);
    cap.setDoubleBuffered(false);
       
    pBufferSizeX = min(canvasLimit, expectedMaxSizeX);
    pBufferSizeY = min(canvasLimit, expectedMaxSizeY);
       
    pBuffer = factory.createGLPbuffer(null,
        cap, null, pBufferSizeX, pBufferSizeY, null);
   
    pBuffer.getContext().makeCurrent();
    gl = pBuffer.getGL().getGL2();
   
View Full Code Here

Examples of javax.media.opengl.GLDrawableFactory

                ContextManager.removeContext(_offscreenDrawable.getContext());
            }

            // Make our GLPbuffer...
            final GLProfile profile = _capsUtil.getProfile();
            final GLDrawableFactory fac = GLDrawableFactory.getFactory(profile);
            final GLCapabilities caps = new GLCapabilities(profile);
            caps.setHardwareAccelerated(true);
            caps.setDoubleBuffered(true);
            caps.setAlphaBits(_settings.getAlphaBits());
            caps.setDepthBits(_settings.getDepthBits());
            caps.setNumSamples(_settings.getSamples());
            caps.setSampleBuffers(_settings.getSamples() != 0);
            caps.setStencilBits(_settings.getStencilBits());
            caps.setDoubleBuffered(false);
            caps.setOnscreen(false);
            caps.setPBuffer(true);
            _offscreenDrawable = fac.createOffscreenAutoDrawable(null, caps, null, _width, _height, _parentContext);
            _context = _offscreenDrawable.getContext();

            _context.makeCurrent();

            final JoglContextCapabilities contextCaps = new JoglContextCapabilities(_offscreenDrawable.getGL());
View Full Code Here

Examples of javax.media.opengl.GLDrawableFactory

      // pbuffer - not tested because Mac OS X 10.7+ supports FBO
      else {
        // Create new GLDrawable (pbuffer) and update the coresponding GLContext

        final GLContext currentContext = GLContext.getCurrent();
        final GLDrawableFactory factory = glDrawble.getFactory();

        // Ensure to sync GL command stream
        if (currentContext != glContext) {
          glContext.makeCurrent();
        }
             gl.glFinish();
             glContext.release();

             if (proxySurface != null) {
               proxySurface.enableUpstreamSurfaceHookLifecycle(false);
             }

             try {
               glDrawble.setRealized(false);
               // New GLDrawable
               glDrawble = factory.createGLDrawable(surface);
               glDrawble.setRealized(true);

               joglDrawable.setGLDrawable(glDrawble);
             }
             finally {
View Full Code Here

Examples of javax.media.opengl.GLDrawableFactory

        " - " +  supportGLExecutable.version);
    LOGGER.info("DrawingMode.SUBTRACT supported: " + isGlExtBlendSubtractSupported);
  }
 
  private void initialize(int width, int height) {
    GLDrawableFactory drawableFactory = GLDrawableFactory.getFactory(GLProfile.get(GLProfile.GL2));
    AbstractGraphicsDevice graphicsDevice = drawableFactory.getDefaultDevice();

//    if(!drawableFactory.canCreateGLPbuffer(graphicsDevice)) {
//      throw new RuntimeException("PBuffer not supported but required in this implementation!");
//    }
   
    int imageDrawingWidth = properties.getImageDrawingWidth();
    int imageDrawingHeight = properties.getImageDrawingHeight();
    LOGGER.info("Requested image drawing size: " + imageDrawingWidth + "x" + imageDrawingHeight);
   
    if(!(imageRenderContext.getDrawable() instanceof GLPbuffer)) {
      boolean cannotCreatePBuffer = !drawableFactory.canCreateGLPbuffer(graphicsDevice);
      // debug fallback
      if(!properties.isPBuffer()) cannotCreatePBuffer = true;
      if(!usePBuffer) cannotCreatePBuffer = true;
      if(!cannotCreatePBuffer) {
        try {
          GLAutoDrawable imageDrawable = drawableFactory.createGLPbuffer(graphicsDevice,
              PBUFFER_CAPABILITIES, null, imageDrawingWidth, imageDrawingHeight, window.getContext());
          imageRenderContext.setDrawable(imageDrawable);
         
          SupportGLExecutable supportGLExecutable = new SupportGLExecutable();
          glExecutor.execute(supportGLExecutable);
View Full Code Here

Examples of javax.media.opengl.GLDrawableFactory

    }
    return true;
  }
 
  private void initialize(boolean lightweight) {
    GLDrawableFactory drawableFactory = GLDrawableFactory.getFactory(GLProfile.get(GLProfile.GL2));
    AbstractGraphicsDevice graphicsDevice = drawableFactory.getDefaultDevice();
    if(!drawableFactory.canCreateGLPbuffer(graphicsDevice)) {
      throw new RuntimeException("PBuffer not supported but required in this implementation!");
    }
   
    int imageDrawingWidth = properties.getImageDrawingWidth();
    int imageDrawingHeight = properties.getImageDrawingHeight();
    LOGGER.info("Requested image drawing size: " + imageDrawingWidth + "x" + imageDrawingHeight);
   
    if(!(imageDrawable instanceof GLPbuffer)) imageDrawable = null;
    if(imageDrawable == null) {
      boolean cannotCreatePBuffer = !drawableFactory.canCreateGLPbuffer(graphicsDevice);
      // debug fallback
      if(!properties.isPBuffer()) cannotCreatePBuffer = true;
      if(!usePBuffer) cannotCreatePBuffer = true;
      if(!cannotCreatePBuffer) {
        try {
          imageDrawable = drawableFactory.createGLPbuffer(graphicsDevice, PBUFFER_CAPABILITIES, null, imageDrawingWidth, imageDrawingHeight, glContext);
          glContext = imageDrawable.getContext();
          imageRenderContext.setDrawable(imageDrawable);
         
          SupportGLExecutable supportGLExecutable = new SupportGLExecutable();
          execute(supportGLExecutable);
View Full Code Here

Examples of javax.media.opengl.GLDrawableFactory

    }
    return true;
  }

  private void initialize(int width, int height) {
    GLDrawableFactory drawableFactory = GLDrawableFactory.getFactory(GLProfile.get(GLProfile.GL2));
    AbstractGraphicsDevice graphicsDevice = drawableFactory.getDefaultDevice();

    if(!drawableFactory.canCreateGLPbuffer(graphicsDevice)) {
      throw new RuntimeException("PBuffer not supported but required in this implementation!");
    }
   
    int imageDrawingWidth = properties.getImageDrawingWidth();
    int imageDrawingHeight = properties.getImageDrawingHeight();
    LOGGER.info("Requested image drawing size: " + imageDrawingWidth + "x" + imageDrawingHeight);
   
    if(!(imageDrawable instanceof GLPbuffer)) imageDrawable = null;
    if(imageDrawable == null) {
      boolean cannotCreatePBuffer = !drawableFactory.canCreateGLPbuffer(graphicsDevice);
      // debug fallback
      if(!properties.isPBuffer()) cannotCreatePBuffer = true;
      if(!usePBuffer) cannotCreatePBuffer = true;
      if(!cannotCreatePBuffer) {
        try {
          imageDrawable = drawableFactory.createGLPbuffer(graphicsDevice, PBUFFER_CAPABILITIES, null, imageDrawingWidth, imageDrawingHeight, glContext);
          glContext = imageDrawable.getContext();
          imageRenderContext.setDrawable(imageDrawable);
         
          SupportGLExecutable supportGLExecutable = new SupportGLExecutable();
          execute(supportGLExecutable);
View Full Code Here

Examples of javax.media.opengl.GLDrawableFactory

       
//        capabilities.setDepthBits(4);
//        capabilities.setDepthBits(32);

        // get a rendering surface and a context for this canvas
        GLDrawableFactory factory = GLDrawableFactory.getFactory();

        /*
        if (PApplet.platform == PConstants.LINUX) {
          GraphicsConfiguration pconfig = parent.getGraphicsConfiguration();
          System.out.println("parent config is " + pconfig);

          //      GraphicsDevice device = config.getDevice();
          //AbstractGraphicsDevice agd = new AbstractGraphicsDevice(device);
          //AbstractGraphicsConfiguration agc = factory.chooseGraphicsConfiguration(capabilities, null, null);

          AWTGraphicsConfiguration agc = (AWTGraphicsConfiguration)
          factory.chooseGraphicsConfiguration(capabilities, null, null);
          GraphicsConfiguration config = agc.getGraphicsConfiguration();
          System.out.println("agc config is " + config);
        }
        */

        drawable = factory.getGLDrawable(parent, capabilities, null);
        context = drawable.createContext(null);

        // need to get proper opengl context since will be needed below
        gl = context.getGL();
        // Flag defaults to be reset on the next trip into beginDraw().
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.