Exemple #1
0
 private GLXGraphicsConfig(
     X11GraphicsDevice device, int visualnum, long configInfo, ContextCapabilities oglCaps) {
   super(device, visualnum, 0, 0, (oglCaps.getCaps() & CAPS_DOUBLEBUFFERED) != 0);
   pConfigInfo = configInfo;
   initConfig(getAData(), configInfo);
   this.oglCaps = oglCaps;
   context = new OGLContext(OGLRenderQueue.getInstance(), this);
 }
Exemple #2
0
  public static GLXGraphicsConfig getConfig(X11GraphicsDevice device, int visualnum) {
    if (!X11GraphicsEnvironment.isGLXAvailable()) {
      return null;
    }

    long cfginfo = 0;
    final String ids[] = new String[1];
    OGLRenderQueue rq = OGLRenderQueue.getInstance();
    rq.lock();
    try {
      // getGLXConfigInfo() creates and destroys temporary
      // surfaces/contexts, so we should first invalidate the current
      // Java-level context and flush the queue...
      OGLContext.invalidateCurrentContext();
      GLXGetConfigInfo action = new GLXGetConfigInfo(device.getScreen(), visualnum);
      rq.flushAndInvokeNow(action);
      cfginfo = action.getConfigInfo();
      if (cfginfo != 0L) {
        OGLContext.setScratchSurface(cfginfo);
        rq.flushAndInvokeNow(
            new Runnable() {
              public void run() {
                ids[0] = OGLContext.getOGLIdString();
              }
            });
      }
    } finally {
      rq.unlock();
    }
    if (cfginfo == 0) {
      return null;
    }

    int oglCaps = getOGLCapabilities(cfginfo);
    ContextCapabilities caps = new OGLContextCaps(oglCaps, ids[0]);

    return new GLXGraphicsConfig(device, visualnum, cfginfo, caps);
  }