From 9f3bf8307320cf80f67e0af707614f0304507731 Mon Sep 17 00:00:00 2001 From: Kenneth Russel <kbrussel@alum.mit.edu> Date: Mon, 18 Jul 2005 21:28:48 +0000 Subject: Implemented pbuffer instantiation support in GLDrawableFactory rather than GLCanvas on Windows. Restructured GLJPanel and jogl-demos to use new APIs. Still needs to be ported to other platforms. git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/../svn-server-sync/jogl-demos/branches/JSR-231@104 3298f667-5e0e-4b4a-8ed4-a3559d26a5f4 --- src/demos/hwShadowmapsSimple/HWShadowmapsSimple.java | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'src/demos/hwShadowmapsSimple/HWShadowmapsSimple.java') diff --git a/src/demos/hwShadowmapsSimple/HWShadowmapsSimple.java b/src/demos/hwShadowmapsSimple/HWShadowmapsSimple.java index cd70062..a59b208 100644 --- a/src/demos/hwShadowmapsSimple/HWShadowmapsSimple.java +++ b/src/demos/hwShadowmapsSimple/HWShadowmapsSimple.java @@ -234,7 +234,11 @@ public class HWShadowmapsSimple { // init pbuffer GLCapabilities caps = new GLCapabilities(); caps.setDoubleBuffered(false); - pbuffer = drawable.createOffscreenDrawable(caps, TEX_SIZE, TEX_SIZE); + + if (!GLDrawableFactory.getFactory().canCreateGLPbuffer(caps, TEX_SIZE, TEX_SIZE)) { + unavailableExtension("Can not create pbuffer"); + } + pbuffer = GLDrawableFactory.getFactory().createGLPbuffer(caps, TEX_SIZE, TEX_SIZE, drawable.getContext()); pbuffer.addGLEventListener(new PbufferListener()); // Register the window with the ManipManager @@ -344,11 +348,15 @@ public class HWShadowmapsSimple { private void checkExtension(GL gl, String extensionName) { if (!gl.isExtensionAvailable(extensionName)) { String message = "Unable to initialize " + extensionName + " OpenGL extension"; - JOptionPane.showMessageDialog(null, message, "Unavailable extension", JOptionPane.ERROR_MESSAGE); - throw new GLException(message); + unavailableExtension(message); } } + private void unavailableExtension(String message) { + JOptionPane.showMessageDialog(null, message, "Unavailable extension", JOptionPane.ERROR_MESSAGE); + throw new GLException(message); + } + private void dispatchKey(char k) { switch (k) { case 27: -- cgit v1.2.3