28package com.jogamp.opengl.demos.androidfat;
30import java.nio.Buffer;
31import java.nio.ByteBuffer;
32import java.util.ArrayList;
34import com.jogamp.opengl.GLCapabilities;
35import com.jogamp.opengl.GLProfile;
36import com.jogamp.opengl.demos.androidfat.OrderedProperties;
37import com.jogamp.opengl.demos.es2.GearsES2;
39import jogamp.newt.driver.android.NewtBaseActivity;
41import com.jogamp.common.util.InterruptSource;
42import com.jogamp.newt.event.MonitorEvent;
43import com.jogamp.newt.event.MouseAdapter;
44import com.jogamp.newt.event.MouseEvent;
45import com.jogamp.newt.event.MonitorModeListener;
46import com.jogamp.newt.opengl.GLWindow;
48import com.jogamp.opengl.util.Animator;
50import android.os.Bundle;
51import android.util.Log;
54 static String TAG =
"NEWTGearsES2Activity";
56 static final String forceRGBA5650 =
"demo.force.rgba5650";
57 static final String forceECT =
"demo.force.ect";
58 static final String forceKillProcessTest =
"demo.force.killProcessTest";
90 public void onCreate(
final Bundle savedInstanceState) {
91 Log.d(TAG,
"onCreate - 0");
95 super.onCreate(savedInstanceState);
99 if(
null != System.getProperty(forceRGBA5650) ) {
100 Log.d(TAG,
"forceRGBA5650");
104 Log.d(TAG,
"req caps: "+caps);
107 setContentView(getWindow(), glWindow);
114 public void monitorModeChangeNotify(
final MonitorEvent me) { }
116 public void monitorModeChanged(
final MonitorEvent me,
final boolean success) {
117 System.err.println(
"MonitorMode Changed (success "+success+
"): "+me);
120 if(
null != System.getProperty(forceKillProcessTest) ) {
121 Log.d(TAG,
"forceKillProcessTest");
124 public void mousePressed(
final MouseEvent e) {
126 Log.d(TAG,
"MemoryHog");
127 new InterruptSource.Thread(
null,
new Runnable() {
130 final ArrayList<Buffer> buffers =
new ArrayList<Buffer>();
132 final int halfMB = 512 * 1024;
133 final float osizeMB = buffers.size() * 0.5f;
134 final float nsizeMB = osizeMB + 0.5f;
135 System.err.println(
"MemoryHog: ****** +4k: "+osizeMB+
" MB +"+nsizeMB+
" MB - Try");
136 buffers.add(ByteBuffer.allocateDirect(halfMB));
137 System.err.println(
"MemoryHog: ****** +4k: "+osizeMB+
" MB +"+nsizeMB+
" MB - Done");
140 }
catch (
final Exception e) { e.printStackTrace(); };
142 } },
"MemoryHog").start();
144 Log.d(TAG,
"ForceKill");
145 android.os.Process.killProcess( android.os.Process.myPid() );
154 if(
null != System.getProperty(forceECT) ) {
155 Log.d(TAG,
"forceECT");
165 Log.d(TAG,
"onCreate - X");
void setRedBits(final int redBits)
Sets the number of bits requested for the color buffer's red component.
void setGreenBits(final int greenBits)
Sets the number of bits requested for the color buffer's green component.
void setBlueBits(final int blueBits)
Sets the number of bits requested for the color buffer's blue component.
abstract void addMonitorModeListener(MonitorModeListener sml)
Pointer event of type PointerType.
final int getPointerCount()
See details for multiple-pointer events.
An implementation of GLAutoDrawable and Window interface, using a delegated Window instance,...
final void addMouseListener(final MouseListener l)
Appends the given MouseListener to the end of the list.
final boolean setFullscreen(final boolean fullscreen)
Enable or disable fullscreen mode for this window.
final void setVisible(final boolean visible)
Calls setVisible(true, visible), i.e.
static GLWindow create(final GLCapabilitiesImmutable caps)
Creates a new GLWindow attaching a new Window referencing a new default Screen and default Display wi...
Specifies a set of OpenGL capabilities.
Specifies the the OpenGL profile.
static final String GL2ES2
The intersection of the desktop GL3, GL2 and embedded ES2 profile.
static GLProfile get(final AbstractGraphicsDevice device, String profile)
Returns a GLProfile object.
final void setProperty(final String key, final String value)
final void setSystemProperties()
void onCreate(final Bundle savedInstanceState)
final void resetFPSCounter()
Reset all performance counter (startTime, currentTime, frame number)
final synchronized Thread setExclusiveContext(final Thread t)
Dedicate all GLAutoDrawable's context to the given exclusive context thread.
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.