I want to use JOGL 2.x for a console/terminal based image manipulation program without any GUI/window. Unfortunately, I don’t find a way to create and opengl context easily.
I know there are pbuffers, but AFAIK these are platform dependent and not very flexible in the format (floating point formats only?). That is why I use a framebuffer object with a texture2D as color component. That works fine, but it seems I still need a window or pbuffer to create the GLContext. Currently, I use a 1x1 sized pbuffer to get an ‘offscreen’ opeengl context like this:
GLCapabilities caps = new GLCapabilities(GLProfile.getDefault());
caps.setDoubleBuffered(false);
GLCapabilitiesChooser capsChooser = new DefaultGLCapabilitiesChooser();
GLPbuffer pBuffer = GLDrawableFactory.getFactory(GLProfile.getDefault()).createGLPbuffer(caps, capsChooser, 1, 1, null);
GLContext context = pBuffer.getContext();
context.makeCurrent();
GL gl = context.getGL();
// my offscreen rendering code goes here
context.destroy();
Is this necessary or can I create an opengl context without a pbuffer (and window)?