public JoglPanel(final TestbedModel model, final TestbedController controller) { super(new GLCapabilities(GLProfile.getDefault())); this.controller = controller; setSize(600, 600); setPreferredSize(new Dimension(600, 600)); setAutoSwapBufferMode(true); addGLEventListener(this); AWTPanelHelper.addHelpAndPanelListeners(this, model, controller, SCREEN_DRAG_BUTTON); }
@Override public final GLCapabilitiesImmutable getChosenGLCapabilities() { // FIXME: should do better than this; is it possible to query J2D Caps ? return new GLCapabilities(null); }
private static GLCapabilitiesImmutable getCapabilities(GLProfile profile) { GLCapabilities capabilitys = new GLCapabilities(profile); // c.setSampleBuffers(true); // c.setNumSamples(16); // capabilitys.setHardwareAccelerated(true); // capabilitys.setDoubleBuffered(true); // capabilitys.setBackgroundOpaque(false); return capabilitys; } }
public vtkJoglPanelComponent(vtkRenderWindow renderWindow) { this(renderWindow, new GLCapabilities(GLProfile.getDefault())); }
public vtkJoglCanvasComponent(vtkRenderWindow renderWindow) { this(renderWindow, new GLCapabilities(GLProfile.getDefault())); }
private synchronized GLPbuffer createBuffer( int width, int height ) { GLDrawableFactory glFactory = GLDrawableFactory.getFactory(); // Create the offscreen drawable (pBuffer). Note that the width // and height must be a power of two if it is to be used as a // texture. // GLCanvas d = new GLCanvas(); if ( glFactory.canCreateGLPbuffer() ) { GLCapabilities caps = new GLCapabilities(); GLPbuffer buf = glFactory.createGLPbuffer( caps, null, width, height, null ); return buf; // buffer.addGLEventListener(new PBufferGLEventListener(pBufferTexID,128,128,glu)); } throw new UnsupportedOperationException( "Your graphic hardware does not support GLPbuffers, you can not run the WPVS." ); }
public static Component createGLCanvas(int width, int height, boolean useSwing) { GraphicsDevice device = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice(); GLCapabilities caps = new GLCapabilities(GLProfile.get(GLProfile.GL2)); Component canvas = useSwing ? new GLJPanel(caps) : new GLCanvas(caps); canvas.setSize(width, height); canvas.setIgnoreRepaint(true); canvas.setPreferredSize(new Dimension(width, height)); canvas.setSize(new Dimension(width, height)); return canvas; }
/** * creates and returns a canvas for offscreen rendering * * @return a offscreen Canvas3D on which the the scene will be rendered. */ protected static synchronized GLPbuffer createOffscreenBuffer() { // Create the offscreen drawable (pBuffer). Note that the width // and height must be a power of two if it is to be used as a // texture. // GLCanvas d = new GLCanvas(); if ( GLDrawableFactory.getFactory().canCreateGLPbuffer() ) { // System.out.println( "YES" ); GLCapabilities caps = new GLCapabilities(); GLPbuffer buf = GLDrawableFactory.getFactory().createGLPbuffer( caps, null, 800, 600, null// d.getContext() ); return buf; // buffer.addGLEventListener(new PBufferGLEventListener(pBufferTexID,128,128,glu)); } System.err.println( "Can't create a pBuffer." ); // System.exit(1); return null; }
final static public void initCaps(boolean stereo){ if (caps != null){ return; } //System.out.println("profile -- is GL2 = " + profile.isGL2()+" -- isHardwareRasterizer = "+ profile.isHardwareRasterizer()); caps = new GLCapabilities(profile); //caps.setAlphaBits(8); //anti-aliasing caps.setSampleBuffers(true); caps.setNumSamples(4); //avoid flickering caps.setDoubleBuffered(true); //caps.setDoubleBuffered(false); if (stereo){ //add stereo caps.setStereo(true); } //stencil buffer is needed for hacked passive 3D caps.setStencilBits(1); }
final GLCapabilitiesImmutable caps = new GLCapabilities( GLProfile.getDefault(GLProfile.getDefaultDevice()) ); final Display display = new Display(); final Shell shell = new Shell(display);
final GLCapabilities glcapsDefault = new GLCapabilities(GLProfile.getDefault()); cfg = X11GLXGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic(glcapsDefault, glcapsDefault, null, x11Screen, VisualIDHolder.VID_UNDEFINED); if(DEBUG) {
private void debug(final GL gl) { dbgFrame = new Frame("TextRenderer Debug Output"); final GLCanvas dbgCanvas = new GLCanvas(new GLCapabilities(gl.getGLProfile())); dbgCanvas.setSharedContext(GLContext.getCurrent()); dbgCanvas.addGLEventListener(new DebugListener(gl, dbgFrame)); dbgFrame.add(dbgCanvas); final FPSAnimator anim = new FPSAnimator(dbgCanvas, 10); dbgFrame.addWindowListener(new WindowAdapter() { @Override public void windowClosing(final WindowEvent e) { // Run this on another thread than the AWT event queue to // make sure the call to Animator.stop() completes before // exiting new Thread(new Runnable() { @Override public void run() { anim.stop(); } }).start(); } }); dbgFrame.setSize(kSize, kSize); dbgFrame.setVisible(true); anim.start(); debugged = true; }
public void init( Composite parent, GLProfile glProfile, GLContext context, int options ) { this.glProfile = glProfile; this.glCapabilities = new GLCapabilities( glProfile ); this.glWindow = GLWindow.create( glCapabilities ); if ( context != null ) this.glWindow.setSharedContext( context ); this.glListener = createGLEventListener( ); this.glWindow.addGLEventListener( this.glListener ); FillLayout layout = new FillLayout( ); this.setLayout( layout ); this.glCanvas = new NewtCanvasSWT( this, options, glWindow ) { @Override public void setBounds( int x, int y, int width, int height ) { //do not allow a size of 0,0, because NEWT window becomes invisible super.setBounds( x, y, Math.max( 1, width ), Math.max( 1, height ) ); } }; this.glWindow.addGLEventListener( createGLEventListener( ) ); this.layoutManager = new LayoutManager( ); this.mouseHelper = new MouseWrapperNewt( this ); this.glWindow.addMouseListener( this.mouseHelper ); this.isDestroyed = false; this.disposeListeners = new CopyOnWriteArrayList<GLRunnable>( ); }
private void setupOpenGL( boolean testSphere ) { GLCapabilities caps = new GLCapabilities(); caps.setDoubleBuffered( true ); caps.setHardwareAccelerated( true ); caps.setAlphaBits( 8 ); caps.setAccumAlphaBits( 8 ); openGLEventListener = new OpenGLEventHandler( testSphere ); canvas = new GLCanvas( caps ); canvas.addGLEventListener( openGLEventListener ); canvas.addMouseListener( openGLEventListener.getTrackBall() ); canvas.addMouseWheelListener( openGLEventListener.getTrackBall() ); canvas.addMouseMotionListener( openGLEventListener.getTrackBall() ); getContentPane().add( canvas, BorderLayout.CENTER ); }
capsChosen = new GLCapabilities(null);
public GLCanvas createGLCanvas(int width, int height) { //GraphicsDevice device = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice(); GLCapabilities caps = new GLCapabilities(GLProfile.get(GLProfile.GL2)); caps.setHardwareAccelerated(true); caps.setDoubleBuffered(true); GLCanvas glCanvas = new GLCanvas(caps);//new GLCapabilities(GLProfile.get(GLProfile.GL))); //GLCapabilitiesImmutable icaps = glCanvas.getChosenGLCapabilities(); //boolean hwa = icaps.getHardwareAccelerated(); glCanvas.setSize( width, height ); glCanvas.setIgnoreRepaint( true ); return glCanvas; }
cfg = WindowsWGLGraphicsConfigurationFactory.createDefaultGraphicsConfiguration(new GLCapabilities(GLProfile.getDefault()), aScreen); cfg.markExternal(); if(DEBUG) {
@Override public final GLDrawable createOffscreenDrawable(final AbstractGraphicsDevice deviceReq, final GLCapabilitiesImmutable capsRequested, final GLCapabilitiesChooser chooser, final int width, final int height) { if(width<=0 || height<=0) { throw new GLException("initial size must be positive (were (" + width + " x " + height + "))"); } final AbstractGraphicsDevice device = getOrCreateSharedDevice(deviceReq); if(null == device) { throw new GLException("No shared device for requested: "+deviceReq); } final GLCapabilitiesImmutable capsChosen = GLGraphicsConfigurationUtil.fixOffscreenGLCapabilities(capsRequested, this, device); if( capsChosen.isFBO() ) { // Use minimum GLCapabilities for the dummy surface w/ same profile final ProxySurface dummySurface = createDummySurfaceImpl(device, true, new GLCapabilities(capsChosen.getGLProfile()), capsRequested, null, width, height); final GLDrawableImpl dummyDrawable = createOnscreenDrawableImpl(dummySurface); return new GLFBODrawableImpl.ResizeableImpl(this, dummyDrawable, dummySurface, capsChosen, 0); } return createOffscreenDrawableImpl( createMutableSurfaceImpl(device, true, capsChosen, capsRequested, chooser, new UpstreamSurfaceHookMutableSize(width, height) ) ); }
caps = (GLCapabilities) userCapsRequest.cloneMutable(); } else { caps = new GLCapabilities(GLProfile.getDefault(GLProfile.getDefaultDevice()));
final GLCapabilities caps = new GLCapabilities( glp );