package com.io7m.scontext;

import com.jogamp.opengl.GLCapabilities;
import com.jogamp.opengl.GLContext;
import com.jogamp.opengl.GLDrawableFactory;
import com.jogamp.opengl.GLOffscreenAutoDrawable;
import com.jogamp.opengl.GLProfile;

public final class CreateUnsharedContext0 {
	public static void main(String[] args)
	{
	    final GLProfile profile = GLProfile.get(GLProfile.GL3);
	    final GLCapabilities cap = new GLCapabilities(profile);
	    cap.setFBO(true);
	    final GLDrawableFactory f = GLDrawableFactory.getFactory(profile);
	    final GLOffscreenAutoDrawable drawable =
	      f.createOffscreenAutoDrawable(null, cap, null, 640, 480);
	    drawable.display();
	    
	    final GLContext c = drawable.getContext();
	    final int r = c.makeCurrent();
	    if (r == GLContext.CONTEXT_NOT_CURRENT) {
	      throw new AssertionError("Could not make context current");
	    }
	    
	    drawable.destroy();
	}
}
