Java Code Examples for com.jogamp.opengl.GL2ES2#GL_COLOR_ATTACHMENT0

The following examples show how to use com.jogamp.opengl.GL2ES2#GL_COLOR_ATTACHMENT0 . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DwGLFrameBuffer.java    From PixelFlow with MIT License 6 votes vote down vote up
public void bind(int ... HANDLE_tex){
  
  if(IS_ACTIVE){
    unbind(); // unbind, in case of bind() is called consecutively
  }
  
  int count = HANDLE_tex.length;  
  if(count > max_draw_buffers){
    System.out.println("WARNING: DwGLFrameBuffer.bind(...) number of textures exceeds max limit: "+count+" > "+max_draw_buffers);
    count = max_draw_buffers;
  }
  bind_color_attachments = new int[count];
  bind_targets           = new int[count];
  
  bindFBO();
  for(int i = 0; i < count; i++){
    bind_color_attachments[i] = GL2ES2.GL_COLOR_ATTACHMENT0 + i;
    bind_targets          [i] = GL2ES2.GL_TEXTURE_2D;
    gl.glFramebufferTexture2D(GL2ES2.GL_FRAMEBUFFER, bind_color_attachments[i], GL2ES2.GL_TEXTURE_2D, HANDLE_tex[i], 0);
  }
  
  gl.glDrawBuffers(bind_color_attachments.length, bind_color_attachments, 0);
  IS_ACTIVE = true;
}
 
Example 2
Source File: DwGLFrameBuffer.java    From PixelFlow with MIT License 6 votes vote down vote up
public void bind(DwGLTexture ... tex){
 
  if(IS_ACTIVE){
    unbind(); // unbind, in case of bind() is called consecutively
  }
  
  int count = tex.length;  
  if(count > max_draw_buffers){
    System.out.println("WARNING: DwGLFrameBuffer.bind(...) number of textures exceeds max limit: "+count+" > "+max_draw_buffers);
    count = max_draw_buffers;
  }
  bind_color_attachments = new int[count];
  bind_targets           = new int[count];
  
  bindFBO();
  for(int i = 0; i < count; i++){
    bind_color_attachments[i] = GL2ES2.GL_COLOR_ATTACHMENT0 + i;
    bind_targets          [i] = tex[i].target;
    gl.glFramebufferTexture2D(GL2ES2.GL_FRAMEBUFFER, bind_color_attachments[i], tex[i].target, tex[i].HANDLE[0], 0);
  }
  
  
  gl.glDrawBuffers(bind_color_attachments.length, bind_color_attachments, 0);
  IS_ACTIVE = true;
}
 
Example 3
Source File: DwGLFrameBuffer.java    From PixelFlow with MIT License 6 votes vote down vote up
public void bind(DwGLTexture3D[] tex, int[] layer){
 
  if(IS_ACTIVE){
    unbind(); // unbind, in case of bind() is called consecutively
  }

  int count = tex.length;  
  if(count > max_draw_buffers){
    System.out.println("WARNING: DwGLFrameBuffer.bind(...) number of textures exceeds max limit: "+count+" > "+max_draw_buffers);
    count = max_draw_buffers;
  }
  bind_color_attachments = new int[count];
  bind_targets           = new int[count];
  
  bindFBO();
  for(int i = 0; i < count; i++){
    bind_color_attachments[i] = GL2ES2.GL_COLOR_ATTACHMENT0 + i;
    bind_targets          [i] = tex[i].target;
    gl.glFramebufferTexture3D(GL2ES2.GL_FRAMEBUFFER, bind_color_attachments[i], tex[i].target, tex[i].HANDLE[0], 0, layer[i]);
  }
  
  gl.glDrawBuffers(bind_color_attachments.length, bind_color_attachments, 0);
  IS_ACTIVE = true;
}
 
Example 4
Source File: DwPixelFlow.java    From PixelFlow with MIT License 5 votes vote down vote up
public void getGLTextureHandle(PGraphicsOpenGL pg, int[] tex_handle){
  int fbo_handle = pg.getFrameBuffer().glFbo;
  int target     = GL2ES2.GL_FRAMEBUFFER;
  int attachment = GL2ES2.GL_COLOR_ATTACHMENT0;
  int[] params   = new int[1]; 
  gl.glBindFramebuffer(target, fbo_handle);
  gl.glGetFramebufferAttachmentParameteriv(target, attachment, GL2ES2.GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, params, 0);
  if( params[0] == GL2ES2.GL_TEXTURE){
    gl.glGetFramebufferAttachmentParameteriv(target, attachment, GL2ES2.GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME, params, 0);
    tex_handle[0] = params[0];
  } else {
    tex_handle[0] = -1;
  }
  gl.glBindFramebuffer(target, 0);
}