@Override public final GL setGL(final GL gl) { final GLContext _context = context; if (_context != null) { _context.setGL(gl); return gl; } return null; }
@Override public final GL setGL(final GL gl) { final GLContext _context = context; if (_context != null) { _context.setGL(gl); return gl; } return null; }
@Override public void init(final GLAutoDrawable drawable) { GL _gl = drawable.getGL(); if(glDebug) { try { _gl = _gl.getContext().setGL( GLPipelineFactory.create("com.jogamp.opengl.Debug", null, _gl, null) ); } catch (final Exception e) {e.printStackTrace();} } if(glTrace) { try { // Trace .. _gl = _gl.getContext().setGL( GLPipelineFactory.create("com.jogamp.opengl.Trace", null, _gl, new Object[] { System.err } ) ); } catch (final Exception e) {e.printStackTrace();} } _gl.setSwapInterval(glSwapInterval); } @Override
private void setDebugPipeline(final GLAutoDrawable pDrawable) { if (mAlreadyInDebugMode || !isDebugMode()) return; final GL lGL = pDrawable.getGL(); lGL.getContext() .setGL(GLPipelineFactory.create("com.jogamp.opengl.Debug", null, lGL, null)); mAlreadyInDebugMode = true; }
/** * Called when the {@link GLAutoDrawable} is rendered for the first time. * When one calls Scene.init() function, this function is called and makes * the OpenGL buffers initialization. * * Note: in this implementation, GL Exceptions are not triggered. To do so, * make te following call at the beginning of the init() body: <code> * canvas.setGL( new DebugGL(canvas.getGL()) ); * </code> */ @Override public void init(GLAutoDrawable canvas) { if (canvas != null && canvas.getGL() != null && canvas.getGL().getGL2() != null && view != null) { if (debugGL) canvas.getGL().getContext().setGL(GLPipelineFactory.create("com.jogamp.opengl.Debug", null, canvas.getGL(), null)); if (traceGL) canvas.getGL().getContext().setGL(GLPipelineFactory.create("com.jogamp.opengl.Trace", null, canvas.getGL(), new Object[] { System.err })); view.init(canvas.getGL()); } }
/** * @param gl * @param mode one of the {@link ShaderSelectionMode}s * @param pmvMatrix optional pass through PMVMatrix for the {@link FixedFuncHook} and {@link FixedFuncPipeline} * @return If gl is a GL2ES1 and force is false, return the type cast object, * otherwise create a fixed function emulation pipeline using the given GL2ES2 impl * and hook it to the GLContext via {@link GLContext#setGL(GL)}. * @throws GLException if the GL object is neither GL2ES1 nor GL2ES2 * * @see ShaderSelectionMode#AUTO * @see ShaderSelectionMode#COLOR * @see ShaderSelectionMode#COLOR_LIGHT_PER_VERTEX * @see ShaderSelectionMode#COLOR_TEXTURE * @see ShaderSelectionMode#COLOR_TEXTURE_LIGHT_PER_VERTEX */ public static final GL2ES1 wrapFixedFuncEmul(final GL gl, final ShaderSelectionMode mode, final PMVMatrix pmvMatrix, final boolean force, final boolean verbose) { if(gl.isGL2ES2() && ( !gl.isGL2ES1() || force ) ) { final GL2ES2 es2 = gl.getGL2ES2(); final FixedFuncHook hook = new FixedFuncHook(es2, mode, pmvMatrix); hook.setVerbose(verbose); final FixedFuncImpl impl = new FixedFuncImpl(es2, hook); gl.getContext().setGL(impl); return impl; } else if(gl.isGL2ES1()) { return gl.getGL2ES1(); } throw new GLException("GL Object is neither GL2ES1 nor GL2ES2: "+gl.getContext()); }