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:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
| 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);
final GLPbuffer offScreenCanvas = GLDrawableFactory.getFactory().createGLPbuffer(cap, width, height, null); |
Where setCapabilitiies() is:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
| private final void setCapabilities(GLCapabilities cap, final boolean stereo, final boolean offScreen) { cap.setDepthBits(24); cap.setRedBits(8); cap.setBlueBits(8); cap.setGreenBits(8); cap.setAlphaBits(8);
cap.setAccumRedBits(16); cap.setAccumGreenBits(16); cap.setAccumBlueBits(16); cap.setAccumAlphaBits(16);
cap.setStencilBits(8);
if (offScreen) cap.setDoubleBuffered(false); else { cap.setDoubleBuffered(true); 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.<init>(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