Пример #1
0
  public void attachDepthRBO(GL2GL3 gl, int width, int height) {
    int[] id = new int[1];
    gl.glGenRenderbuffers(1, id, 0);
    rboid = id[0];
    gl.glBindRenderbuffer(GL2.GL_RENDERBUFFER, rboid);
    gl.glRenderbufferStorage(GL2.GL_RENDERBUFFER, GL2.GL_DEPTH_COMPONENT, width, height);
    gl.glBindRenderbuffer(GL2.GL_RENDERBUFFER, 0);

    gl.glBindFramebuffer(GL2.GL_FRAMEBUFFER, fboid);
    gl.glFramebufferRenderbuffer(
        GL2.GL_FRAMEBUFFER, GL2.GL_DEPTH_ATTACHMENT, GL2.GL_RENDERBUFFER, rboid);
    gl.glEnable(GL2.GL_DEPTH_TEST);
    gl.glBindFramebuffer(GL2.GL_FRAMEBUFFER, 0);
  }
Пример #2
0
  public void renderingToWindow(
      GL2GL3 gl, int offsetx, int offsety, int width, int height, boolean show) {
    gl.glBindFramebuffer(GL2.GL_FRAMEBUFFER, 0);
    // gl.glClearColor(1, 1, 1, 1);
    gl.glViewport(offsetx, offsety, width, height);

    renderingToWindow(gl, show);

    gl.glFlush();
  }
Пример #3
0
 public static void unbind(GL2GL3 gl) {
   gl.glDrawBuffers(1, COLOR_ATTACHMENTS, 0);
   gl.glBindFramebuffer(GL2.GL_FRAMEBUFFER, 0);
 }
Пример #4
0
 public void bind(GL2GL3 gl) {
   gl.glBindFramebuffer(GL2.GL_FRAMEBUFFER, fboid);
   gl.glDrawBuffers(attachcount, COLOR_ATTACHMENTS, 0);
 }
Пример #5
0
 public void attachDepth(GL2GL3 gl, TextureBase tex) {
   gl.glBindFramebuffer(GL2.GL_FRAMEBUFFER, fboid);
   gl.glFramebufferTextureARB(GL2.GL_FRAMEBUFFER, GL2.GL_DEPTH_ATTACHMENT, tex.getTexID(), 0);
   gl.glEnable(GL2.GL_DEPTH_TEST);
 }
Пример #6
0
 public void attachTexture(GL2GL3 gl, TexBindSet tbs) {
   gl.glBindFramebuffer(GL2.GL_FRAMEBUFFER, fboid);
   gl.glFramebufferTextureARB(
       GL2.GL_FRAMEBUFFER, COLOR_ATTACHMENTS[attachcount], tbs.tex.getTexID(), 0);
   attachcount++;
 }