Hi,
I have been having some problems when i try to create a PBuffer in the following code snippet, it is throwing an exception on the last line:
public synchronized void dumpImage(final int val, final int width, final int height, final String dumpname)
{
if (!GLDrawableFactory.getFactory().canCreateGLPbuffer()) {
System.err.println("Error: canvas does not support off-screen drawables.");
return;
}
boolean oldOffScreen = offScreen;
offScreen = true;
Dimension oldSize = new Dimension(screenDim);
java.awt.Point oldScreenCorner = new java.awt.Point(screenCorner);
screenDim.height = height;
screenDim.width = width;
screenCorner.x = 0;
screenCorner.y = 0;
GLCapabilities cap = new GLCapabilities();
setCapabilities(cap, false, true);
// Creates an offscreen canvas with an empty context that gets created later.
final GLPbuffer offScreenCanvas = GLDrawableFactory.getFactory().createGLPbuffer(cap, width, height, null);
Where setCapabilitiies() is:
private final void setCapabilities(GLCapabilities cap, final boolean stereo, final boolean offScreen) {
cap.setDepthBits(24);
// 24 bit colour:
cap.setRedBits(8);
cap.setBlueBits(8);
cap.setGreenBits(8);
cap.setAlphaBits(8);
cap.setAccumRedBits(16);
cap.setAccumGreenBits(16);
cap.setAccumBlueBits(16);
cap.setAccumAlphaBits(16);
// we only need one stencil bit. But we'll see how many we get...
cap.setStencilBits(8);
if (offScreen) // Off screen renderring
cap.setDoubleBuffered(false);
else {
cap.setDoubleBuffered(true);
// Uncomment this for stereo visual
if(stereo)
cap.setStereo(true);
}
}
I get the following exception:
Exception occurred during event dispatching:
javax.media.opengl.GLException: pbuffer creation error: Couldn’t find a suitable pixel format
at com.sun.opengl.impl.windows.WindowsPbufferGLDrawable.createPbuffer(WindowsPbufferGLDrawable.java:285)
at com.sun.opengl.impl.windows.WindowsPbufferGLDrawable.(WindowsPbufferGLDrawable.java:77)
at com.sun.opengl.impl.windows.WindowsGLDrawableFactory$2.run(WindowsGLDrawableFactory.java:145)
at com.sun.opengl.impl.windows.WindowsGLDrawableFactory.maybeDoSingleThreadedWorkaround(WindowsGLDrawableFactory.java:212)
at com.sun.opengl.impl.windows.WindowsGLDrawableFactory.createGLPbuffer(WindowsGLDrawableFactory.java:162)
at com.baesystems.cfdsystems.draw.JOGL_GLwnd.dumpImage(JOGL_GLwnd.java:278)
at com.baesystems.cfdsystems.draw.GLwnd.setDump(GLwnd.java:2257)
I have no experience of pbuffers and am not sure why it is throwing this exception.
The pc i am running this on is a Windows XP machine with the following graphics settings:
Graphics Card Vendor: Intel
Graphics Card Version: Intel 915G
OpenGL Version: 1.4.0 - Build 4.14.10.4396
Any help or suggestions would be greatfully recieved.
Thanks
Mike