Processing 如何使用jogl 2.0设置四元缓冲

Processing 如何使用jogl 2.0设置四元缓冲,processing,jogl,Processing,Jogl,我正在尝试使用Processing/Java为立体视觉创建一个具有四缓冲的3d渲染器。我使用的硬件已经准备好了,所以这不是问题所在。 我在jogl 1.0中有一个stereo.jar库用于处理1.5,但现在我必须使用Processing 2.0和jogl 2.0,因此我必须调整库 Jogl和Processing的源代码中有些东西发生了变化,我很难找到如何告诉Processing我想要使用四缓冲 这是前面的代码: public class Theatre extends PGraphicsOpen

我正在尝试使用Processing/Java为立体视觉创建一个具有四缓冲的3d渲染器。我使用的硬件已经准备好了,所以这不是问题所在。 我在jogl 1.0中有一个stereo.jar库用于处理1.5,但现在我必须使用Processing 2.0和jogl 2.0,因此我必须调整库

Jogl和Processing的源代码中有些东西发生了变化,我很难找到如何告诉Processing我想要使用四缓冲

这是前面的代码:

public class Theatre extends PGraphicsOpenGL{
protected void allocate()
  {
    if (context == null)
    {
      // If OpenGL 2X or 4X smoothing is enabled, setup caps object for them
      GLCapabilities capabilities = new GLCapabilities();
      // Starting in release 0158, OpenGL smoothing is always enabled
      if (!hints[DISABLE_OPENGL_2X_SMOOTH])
      {
        capabilities.setSampleBuffers(true);
        capabilities.setNumSamples(2);
      }
      else if (hints[ENABLE_OPENGL_4X_SMOOTH])
      {
        capabilities.setSampleBuffers(true);
        capabilities.setNumSamples(4);
      }


      capabilities.setStereo(true);

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

      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().
      settingsInited = false;

    }
    else
    {
      // The following three lines are a fix for Bug #1176
      // http://dev.processing.org/bugs/show_bug.cgi?id=1176
      context.destroy();
      context = drawable.createContext(null);
      gl = context.getGL();
      reapplySettings();
    }
  }
}
这是旧库的渲染器。为了使用它,我需要做尺寸(100100,“立体声剧院”)。 现在我试着直接在我的处理草图中做立体。以下是我正在尝试的:

PGraphicsOpenGL pg = ((PGraphicsOpenGL)g);
pgl = pg.beginPGL();
gl = pgl.gl;
glu = pg.pgl.glu;
gl2 = pgl.gl.getGL2();

GLProfile profile = GLProfile.get(GLProfile.GL2);
GLCapabilities capabilities = new GLCapabilities(profile);

capabilities.setSampleBuffers(true);
capabilities.setNumSamples(4);
capabilities.setStereo(true);

GLDrawableFactory factory = GLDrawableFactory.getFactory(profile);
如果我继续,我应该这样做:

drawable = factory.getGLDrawable(parent, capabilities, null);
但是drawable不再是一个领域了,我找不到一个方法来实现它。 如何设置四元缓冲

如果我尝试这样做:

gl2.glDrawBuffer(GL.GL_BACK_RIGHT);
这显然不起作用:/


谢谢。

很高兴看到老板(而不是斯普林斯汀)学会了编码。你有没有浏览过处理opengl包的源代码?是的,我试过,但对我来说水平太低了,我不是慢跑专家。谢谢你的链接