jogl without a GLEventListener?

Hey, I would like to use JOGL without an event listener, somewhere along the lines of obtaining the GLContext and invoking commands to its instance of GL, could anyone help me with this?
incase you need it made any clearer, here is an example:


			int result = context.makeCurrent();
			switch (result) {
				case GLContext.CONTEXT_NOT_CURRENT:
					System.err.println("Couldn't obtain GLContext");
					break;
				default:
					// draw to context.getGL()
					break;
			}
			context.release();

Hi
The book “Pro Java 6 3D game development” shows how this could be done. You can probably google on “Active rendering” and find
some more information about this.
The code in the book is rather old, so i guess you have to replace the code that initialize the rendering canvas with something like this:


AWTGraphicsScreen screen = ( AWTGraphicsScreen)AWTGraphicsScreen.createDefault();
AWTGraphicsConfiguration config = ( AWTGraphicsConfiguration )GraphicsConfigurationFactory
    .getFactory( AWTGraphicsDevice.class ).chooseGraphicsConfiguration( caps, null, screen );

NativeWindow win = NativeWindowFactory.getNativeWindow( this, config );

GLProfile profile = GLProfile.get( GLProfile.GL2 );            
this.drawable = GLDrawableFactory.getFactory( profile ).createGLDrawable( win );
this.context = drawable.createContext( null );

thanks, i solved it before although this is basically what i had :slight_smile:

but now for some reason java is throwing an exception:


Exception in thread "Thread-3" java.lang.RuntimeException: Unable to initialize JAWT
	at com.sun.nativewindow.impl.jawt.JAWT$1.run(JAWT.java:100)
	at java.security.AccessController.doPrivileged(Native Method)
	at com.sun.nativewindow.impl.jawt.JAWT.getJAWT(JAWT.java:95)
	at com.sun.nativewindow.impl.jawt.windows.WindowsJAWTWindow.lockSurface(WindowsJAWTWindow.java:69)
	at com.sun.opengl.impl.GLDrawableImpl.lockSurface(GLDrawableImpl.java:130)
	at com.sun.opengl.impl.windows.wgl.WindowsWGLDrawable.setRealized(WindowsWGLDrawable.java:70)
	at org.peehpee.gl.ui.Canvas3D.run(Canvas3D.java:66)
	at java.lang.Thread.run(Unknown Source)

i’ve never had this before, any ideas?

Gary i had the same problem, i think it’s an actual JOGL bug, if you google it more people are having the problem and there are no answers.