JOGL v2.6.0-rc-20250712
JOGL, High-Performance Graphics Binding for Java™ (public API).
NEWTGearsES2TransActivity.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.es2.GearsES2;
33
34import jogamp.newt.driver.android.NewtBaseActivity;
35
36import com.jogamp.newt.NewtFactory;
37import com.jogamp.newt.Screen;
38import com.jogamp.newt.event.MonitorEvent;
39import com.jogamp.newt.event.MonitorModeListener;
40import com.jogamp.newt.opengl.GLWindow;
41
42import com.jogamp.opengl.util.Animator;
43
44import android.os.Bundle;
45import android.util.Log;
46
47public class NEWTGearsES2TransActivity extends NewtBaseActivity {
48 static String TAG = "NEWTGearsES2TransActivity";
49
50 @Override
51 public void onCreate(final Bundle savedInstanceState) {
52 Log.d(TAG, "onCreate - 0");
53 super.onCreate(savedInstanceState);
54
55 // create GLWindow (-> incl. underlying NEWT Display, Screen & Window)
57 caps.setBackgroundOpaque(false);
58
59 Log.d(TAG, "req caps: "+caps);
61 screen.addReference();
62 final GLWindow glWindow = GLWindow.create(screen, caps);
63 glWindow.setSurfaceSize(2*screen.getWidth()/3, 2*screen.getHeight()/3);
64 glWindow.setUndecorated(true);
65 setContentView(getWindow(), glWindow);
66
67 glWindow.addGLEventListener(new GearsES2(-1));
69 @Override
70 public void monitorModeChangeNotify(final MonitorEvent me) { }
71 @Override
72 public void monitorModeChanged(final MonitorEvent me, final boolean success) {
73 System.err.println("MonitorMode Changed (success "+success+"): "+me);
74 }
75 });
76 final Animator animator = new Animator(glWindow);
77 // glWindow.setSkipContextReleaseThread(animator.getThread());
78
79 glWindow.setVisible(true);
80
81 animator.setUpdateFPSFrames(60, System.err);
82 animator.resetFPSCounter();
83 glWindow.resetFPSCounter();
84
85 screen.removeReference();
86 Log.d(TAG, "onCreate - X");
87 }
88}
void setBackgroundOpaque(final boolean opaque)
Sets whether the surface shall be opaque or translucent.
static Display createDisplay(final String name)
Create a Display entity.
static Screen createScreen(final Display display, final int index)
Create a Screen entity.
A screen may span multiple MonitorDevices representing their combined virtual size.
Definition: Screen.java:58
abstract int getHeight()
abstract int addReference()
See Display#addReference().
abstract void addMonitorModeListener(MonitorModeListener sml)
abstract int removeReference()
See Display#removeReference().
abstract int getWidth()
An implementation of GLAutoDrawable and Window interface, using a delegated Window instance,...
Definition: GLWindow.java:121
final void setVisible(final boolean visible)
Calls setVisible(true, visible), i.e.
Definition: GLWindow.java:615
final void setSurfaceSize(final int pixelWidth, final int pixelHeight)
Sets the size of the window's surface in pixel units which claims the window's client area excluding ...
Definition: GLWindow.java:629
final void setUndecorated(final boolean value)
Definition: GLWindow.java:337
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.
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.
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.