JOGL v2.6.0-rc-20250712
JOGL, High-Performance Graphics Binding for Java™ (public API).
NEWTGraphUI1pActivity.java
Go to the documentation of this file.
1/**
2 * Copyright 2011 JogAmp Community. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without modification, are
5 * permitted provided that the following conditions are met:
6 *
7 * 1. Redistributions of source code must retain the above copyright notice, this list of
8 * conditions and the following disclaimer.
9 *
10 * 2. Redistributions in binary form must reproduce the above copyright notice, this list
11 * of conditions and the following disclaimer in the documentation and/or other materials
12 * provided with the distribution.
13 *
14 * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
15 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
16 * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
19 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
20 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
21 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
22 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 *
24 * The views and conclusions contained in the software and documentation are those of the
25 * authors and should not be interpreted as representing official policies, either expressed
26 * or implied, of JogAmp Community.
27 */
28package com.jogamp.opengl.demos.android;
29
30import com.jogamp.opengl.GLCapabilities;
31import com.jogamp.opengl.GLProfile;
32import com.jogamp.opengl.demos.graph.ui.UISceneDemo20;
33
34import jogamp.newt.driver.android.NewtBaseActivity;
35
36import com.jogamp.newt.event.MonitorEvent;
37import com.jogamp.newt.event.MonitorModeListener;
38import com.jogamp.newt.opengl.GLWindow;
39import com.jogamp.opengl.util.Animator;
40
41import android.os.Bundle;
42import android.util.Log;
43
44public class NEWTGraphUI1pActivity extends NewtBaseActivity {
45 static String TAG = "NEWTGraphUIActivity";
46
47 @Override
48 public void onCreate(final Bundle savedInstanceState) {
49 Log.d(TAG, "onCreate - 0");
50 super.onCreate(savedInstanceState);
51
52 // create GLWindow (-> incl. underlying NEWT Display, Screen & Window)
54 caps.setAlphaBits(4);
55 caps.setNumSamples(4);
56 caps.setSampleBuffers(true);
57 Log.d(TAG, "req caps: "+caps);
58 final GLWindow glWindow = GLWindow.create(caps);
59 glWindow.setFullscreen(true);
60 setContentView(getWindow(), glWindow);
61
62 glWindow.addGLEventListener(new UISceneDemo20(0));
64 @Override
65 public void monitorModeChangeNotify(final MonitorEvent me) { }
66 @Override
67 public void monitorModeChanged(final MonitorEvent me, final boolean success) {
68 System.err.println("MonitorMode Changed (success "+success+"): "+me);
69 }
70 });
71 glWindow.setVisible(true);
72 final Animator animator = new Animator(glWindow);
73
74 animator.setUpdateFPSFrames(60, System.err);
75 animator.resetFPSCounter();
76 glWindow.resetFPSCounter();
77
78 Log.d(TAG, "onCreate - X");
79 }
80}
void setAlphaBits(final int alphaBits)
Sets the number of bits requested for the color buffer's alpha component.
abstract void addMonitorModeListener(MonitorModeListener sml)
An implementation of GLAutoDrawable and Window interface, using a delegated Window instance,...
Definition: GLWindow.java:121
final boolean setFullscreen(final boolean fullscreen)
Enable or disable fullscreen mode for this window.
Definition: GLWindow.java:534
final void setVisible(final boolean visible)
Calls setVisible(true, visible), i.e.
Definition: GLWindow.java:615
static GLWindow create(final GLCapabilitiesImmutable caps)
Creates a new GLWindow attaching a new Window referencing a new default Screen and default Display wi...
Definition: GLWindow.java:169
Specifies a set of OpenGL capabilities.
void setNumSamples(final int numSamples)
If sample buffers are enabled, indicates the number of buffers to be allocated.
void setSampleBuffers(final boolean enable)
Defaults to false.
Specifies the the OpenGL profile.
Definition: GLProfile.java:77
static final String GL2ES2
The intersection of the desktop GL3, GL2 and embedded ES2 profile.
Definition: GLProfile.java:594
static GLProfile get(final AbstractGraphicsDevice device, String profile)
Returns a GLProfile object.
Complex interactive GraphUI Scene demo with different Button and Label Shapes layout on the screen.
final void resetFPSCounter()
Reset all performance counter (startTime, currentTime, frame number)
final void setUpdateFPSFrames(final int frames, final PrintStream out)
void resetFPSCounter()
Reset all performance counter (startTime, currentTime, frame number)
void addGLEventListener(GLEventListener listener)
Adds the given listener to the end of this drawable queue.