com.jogamp.opengl.GLAnimatorControl Java Examples

The following examples show how to use com.jogamp.opengl.GLAnimatorControl. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SWTGLAnimator.java    From gama with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Method uncaughtException()
 * 
 * @see com.jogamp.opengl.GLAnimatorControl.UncaughtExceptionHandler#uncaughtException(com.jogamp.opengl.GLAnimatorControl,
 *      com.jogamp.opengl.GLAutoDrawable, java.lang.Throwable)
 */
@Override
public void uncaughtException(final GLAnimatorControl animator, final GLAutoDrawable drawable,
		final Throwable cause) {
	DEBUG.ERR("Uncaught exception in animator & drawable:");
	cause.printStackTrace();

}
 
Example #2
Source File: GPUUISceneGLListener0A.java    From jogl-samples with MIT License 4 votes vote down vote up
@Override
public void display(final GLAutoDrawable drawable) {
    // System.err.println("GPUUISceneGLListener0A: display");
    final GL2ES2 gl = drawable.getGL().getGL2ES2();

    if(null == labels[currentText]) {
        final float pixelSizeFixed = fontSizeFixedPVP * drawable.getSurfaceHeight();
        final float dyTop = drawable.getSurfaceHeight() - 2f*jogampLabel.getLineHeight();
        final float dxMiddle = drawable.getSurfaceWidth() * relMiddle;
        labels[currentText] = new Label(renderer.getRenderState().getVertexFactory(), renderModes, font, pixelSizeFixed, strings[currentText]);
        labels[currentText].setColor(0.1f, 0.1f, 0.1f, 1.0f);
        labels[currentText].setEnabled(enableOthers);
        labels[currentText].translate(dxMiddle,
                                      dyTop - 1.5f * jogampLabel.getLineHeight()
                                            - 1.5f * truePtSizeLabel.getLineHeight(), 0f);
        labels[currentText].addMouseListener(dragZoomRotateListener);
        sceneUIController.addShape(labels[currentText]);
        System.err.println("Label["+currentText+"] CTOR: "+labels[currentText]);
        System.err.println("Label["+currentText+"] CTOR: "+Arrays.toString(labels[currentText].getTranslate()));
    }
    if( fpsLabel.isEnabled() ) {
        final float lfps, tfps, td;
        final GLAnimatorControl animator = drawable.getAnimator();
        if( null != animator ) {
            lfps = animator.getLastFPS();
            tfps = animator.getTotalFPS();
            td = animator.getTotalFPSDuration()/1000f;
        } else {
            lfps = 0f;
            tfps = 0f;
            td = 0f;
        }
        final String modeS = Region.getRenderModeString(renderModes);
        final String text;
        if( null == actionText ) {
            final String timePrec = gl.isGLES() ? "4.0" : "4.1";
            text = String.format("%03.1f/%03.1f fps, v-sync %d, dpi %.1f, fontSize %.1f, %s-samples %d, q %d, td %"+timePrec+"f, blend %b, alpha %d, msaa %d",
                lfps, tfps, gl.getSwapInterval(), dpiH, fontSizeFixedPVP, modeS, sceneUIController.getSampleCount(), fpsLabel.getQuality(), td,
                renderer.getRenderState().isHintMaskSet(RenderState.BITHINT_BLENDING_ENABLED),
                drawable.getChosenGLCapabilities().getAlphaBits(),
                drawable.getChosenGLCapabilities().getNumSamples());
        } else {
            text = String.format("%03.1f/%03.1f fps, v-sync %d, fontSize %.1f, %s",
                lfps, tfps, gl.getSwapInterval(), fontSizeFixedPVP, actionText);
        }
        fpsLabel.setText(text);
    }
    sceneUIController.display(drawable);
}
 
Example #3
Source File: SWTOpenGLDisplaySurface.java    From gama with GNU General Public License v3.0 4 votes vote down vote up
private GLAnimatorControl createAnimator() {
	final GLAutoDrawable drawable = createCanvas(parent);
	return drawable.getAnimator();
}