I’m trying to re-use a Pbuffer (because making new ones is too slow) but it is failing after several iterations. Here is some really reduced code to demonstrate.
public static void main(String[] args) {
GLPbuffer pBuffer = GLDrawableFactory.getFactory().createGLPbuffer(new GLCapabilities(), null, 512, 512, null);
GLContext context = pBuffer.getContext();
for(int c=0;c<10000;c++) {
context.makeCurrent();
context.release();
System.out.println(c);
}
}
This seems to fail after 4k or so iterations on my box. If I add other (useful) commands in the loop it will fail faster. Sometimes in as few as 4 or 5 iterations. The number of iteration before failure is not consistent. The size of the Pbuffer doesn’t seem to affect the failure rate.
Exception in thread "main" javax.media.opengl.GLException: Error making context current: 0
at com.sun.opengl.impl.windows.WindowsGLContext.makeCurrentImpl(WindowsGLContext.java:169)
at com.sun.opengl.impl.windows.WindowsPbufferGLContext.makeCurrentImpl(WindowsPbufferGLContext.java:102)
at com.sun.opengl.impl.GLContextImpl.makeCurrent(GLContextImpl.java:134)
at com.sri.penrad.analystdisplay.wwj.dstile.UserImportedCache.main(UserImportedCache.java:424)
Can anyone offer help?
WinXP
JSR-231 1.1.1 - May 22