📄 joglshapematchingofflinerenderer.java
字号:
//===========================================================================//=-------------------------------------------------------------------------=//= References: =//= [FUNK2003], Funkhouser, Thomas. Min, Patrick. Kazhdan, Michael. Chen, =//= Joyce. Halderman, Alex. Dobkin, David. Jacobs, David. "A Search =//= Engine for 3D Models", ACM Transactions on Graphics, Vol 22. No1. =//= January 2003. Pp. 83-105 =//===========================================================================package vsdk.framework.shapeMatching;// JOGL classesimport javax.media.opengl.GL;import javax.media.opengl.GLCapabilities;import javax.media.opengl.GLAutoDrawable;import javax.media.opengl.GLEventListener;import javax.media.opengl.GLPbuffer;import javax.media.opengl.GLDrawableFactory;// Vitral classesimport vsdk.framework.Component;public class JoglShapeMatchingOfflineRenderer extends Component implements GLEventListener { private GLPbuffer pbuffer; private boolean ready; private boolean pbufferSupported; private JoglShapeMatchingOfflineRenderable target; public JoglShapeMatchingOfflineRenderer(int imageWidth, int imageHeight, JoglShapeMatchingOfflineRenderable target) { this.target = target; ready = false; // Create a GLCapabilities object for the pbuffer GLCapabilities pbCaps = new GLCapabilities(); pbCaps.setDoubleBuffered(false); if ( !GLDrawableFactory.getFactory().canCreateGLPbuffer() ) { pbufferSupported = false; return; } try { pbuffer = GLDrawableFactory.getFactory().createGLPbuffer(pbCaps, null, imageWidth, imageHeight, null); pbufferSupported = true; pbuffer.addGLEventListener(this); } catch ( Exception e ) { System.err.println("Error creating OpenGL Pbuffer. This program requires a 3D accelerator card."); pbuffer = null; pbufferSupported = false; return; } } public boolean isPbufferSupported() { return pbufferSupported; } public void waitForMe() { if ( pbuffer == null ) { return; } while ( !ready ) { System.out.print("*"); try { Thread.sleep(100); } catch ( Exception e ) { ; } } } public void display(GLAutoDrawable drawable) { GL gl = drawable.getGL(); target.executeRendering(gl); ready = true; } public void execute() { ready = false; if ( pbuffer == null ) return; pbuffer.display(); } public void displayChanged(GLAutoDrawable gLDrawable, boolean modeChanged, boolean deviceChanged) { } public void init( GLAutoDrawable drawable ) { } public void reshape( GLAutoDrawable drawable, int x, int y, int width, int height ) { GL gl = drawable.getGL(); gl.glViewport(0, 0, width, height); }}//===========================================================================//= EOF =//===========================================================================
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -