28package com.jogamp.opengl.demos.android;
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.es2.GearsES2;
38import jogamp.newt.driver.android.NewtBaseActivity;
40import com.jogamp.common.util.InterruptSource;
41import com.jogamp.newt.event.MonitorEvent;
42import com.jogamp.newt.event.MouseAdapter;
43import com.jogamp.newt.event.MouseEvent;
44import com.jogamp.newt.event.MonitorModeListener;
45import com.jogamp.newt.opengl.GLWindow;
47import com.jogamp.opengl.util.Animator;
49import android.os.Bundle;
50import android.util.Log;
53 static String TAG =
"NEWTGearsES2Activity";
55 static final String forceRGBA5650 =
"demo.force.rgba5650";
56 static final String forceECT =
"demo.force.ect";
57 static final String forceKillProcessTest =
"demo.force.killProcessTest";
60 public void onCreate(
final Bundle savedInstanceState) {
61 Log.d(TAG,
"onCreate - 0");
62 super.onCreate(savedInstanceState);
66 if(
null != System.getProperty(forceRGBA5650) ) {
67 Log.d(TAG,
"forceRGBA5650");
71 Log.d(TAG,
"req caps: "+caps);
74 setContentView(getWindow(), glWindow);
81 public void monitorModeChangeNotify(
final MonitorEvent me) { }
83 public void monitorModeChanged(
final MonitorEvent me,
final boolean success) {
84 System.err.println(
"MonitorMode Changed (success "+success+
"): "+me);
87 if(
null != System.getProperty(forceKillProcessTest) ) {
88 Log.d(TAG,
"forceKillProcessTest");
93 Log.d(TAG,
"MemoryHog");
94 new InterruptSource.Thread(
null,
new Runnable() {
97 final ArrayList<Buffer> buffers =
new ArrayList<Buffer>();
99 final int halfMB = 512 * 1024;
100 final float osizeMB = buffers.size() * 0.5f;
101 final float nsizeMB = osizeMB + 0.5f;
102 System.err.println(
"MemoryHog: ****** +4k: "+osizeMB+
" MB +"+nsizeMB+
" MB - Try");
103 buffers.add(ByteBuffer.allocateDirect(halfMB));
104 System.err.println(
"MemoryHog: ****** +4k: "+osizeMB+
" MB +"+nsizeMB+
" MB - Done");
107 }
catch (
final Exception e) { e.printStackTrace(); };
109 } },
"MemoryHog").start();
111 Log.d(TAG,
"ForceKill");
112 android.os.Process.killProcess( android.os.Process.myPid() );
121 if(
null != System.getProperty(forceECT) ) {
122 Log.d(TAG,
"forceECT");
132 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.
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.