21package com.jogamp.opengl.test.junit.jogl.demos.es2;
23import com.jogamp.common.nio.Buffers;
24import com.jogamp.math.Matrix4f;
25import com.jogamp.math.Quaternion;
26import com.jogamp.math.Vec3f;
27import com.jogamp.math.util.PMVMatrix4f;
28import com.jogamp.newt.Window;
29import com.jogamp.newt.event.GestureHandler;
30import com.jogamp.newt.event.KeyAdapter;
31import com.jogamp.newt.event.KeyEvent;
32import com.jogamp.newt.event.KeyListener;
33import com.jogamp.newt.event.MouseEvent;
34import com.jogamp.newt.event.MouseListener;
35import com.jogamp.newt.event.PinchToZoomGesture;
36import com.jogamp.newt.event.GestureHandler.GestureEvent;
37import com.jogamp.opengl.GLRendererQuirks;
38import com.jogamp.opengl.JoglVersion;
39import com.jogamp.opengl.test.junit.jogl.demos.GearsObject;
40import com.jogamp.opengl.util.CustomGLEventListener;
41import com.jogamp.opengl.util.PMVMatrix;
42import com.jogamp.opengl.util.TileRendererBase;
43import com.jogamp.opengl.util.glsl.ShaderCode;
44import com.jogamp.opengl.util.glsl.ShaderProgram;
45import com.jogamp.opengl.util.glsl.ShaderState;
46import com.jogamp.opengl.util.stereo.EyeParameter;
47import com.jogamp.opengl.util.stereo.ViewerPose;
48import com.jogamp.opengl.util.stereo.StereoGLEventListener;
50import java.nio.FloatBuffer;
52import com.jogamp.nativewindow.NativeWindow;
53import com.jogamp.opengl.GL;
54import com.jogamp.opengl.GL2ES2;
55import com.jogamp.opengl.GLAnimatorControl;
56import com.jogamp.opengl.GLAutoDrawable;
57import com.jogamp.opengl.GLProfile;
58import com.jogamp.opengl.GLUniformData;
59import com.jogamp.opengl.fixedfunc.GLMatrixFunc;
66 private final FloatBuffer lightPos = Buffers.newDirectFloatBuffer(
new float[] { 5.0f, 5.0f, 10.0f } );
72 private float view_rotx = 20.0f, view_roty = 30.0f;
73 private boolean flipVerticalInGLOrientation =
false;
74 private final boolean customRendering =
false;
76 private final float view_rotz = 0.0f;
77 private float panX = 0.0f, panY = 0.0f, panZ=0.0f;
78 private volatile GearsObjectES2 gear1=
null, gear2=
null, gear3=
null;
80 private Object syncObjects =
null;
81 private boolean useMappedBuffers =
false;
82 private boolean validateBuffers =
false;
83 private volatile boolean usesSharedGears =
false;
85 private float angle = 0.0f;
86 private int swapInterval = 0;
91 private boolean doRotateBeforePrinting;
93 private boolean doRotate =
true;
94 private boolean ignoreFocus =
false;
95 private float[] clearColor =
null;
96 private boolean clearBuffers =
true;
97 private boolean verbose =
true;
98 private volatile boolean isInit =
false;
104 this.swapInterval = swapInterval;
108 this.swapInterval = 1;
113 tileRendererInUse = tr;
114 doRotateBeforePrinting = doRotate;
119 tileRendererInUse =
null;
124 System.err.println(
"GearsES2.startTileRendering: "+sid()+
""+tr);
128 System.err.println(
"GearsES2.endTileRendering: "+sid()+
""+tr);
139 this.clearColor = clearColor;
142 public void setGearsColors(
final FloatBuffer gear1Color,
final FloatBuffer gear2Color,
final FloatBuffer gear3Color) {
143 this.gear1Color = gear1Color;
144 this.gear2Color = gear2Color;
145 this.gear3Color = gear3Color;
149 sharedGears = shared;
180 private static final int TIME_OUT = 2000;
181 private static final int POLL_DIVIDER = 20;
182 private static final int TIME_SLICE = TIME_OUT / POLL_DIVIDER ;
187 public boolean waitForInit(
final boolean initialized)
throws InterruptedException {
189 for (wait=0; wait<POLL_DIVIDER && initialized != isInit ; wait++) {
190 Thread.sleep(TIME_SLICE);
192 return wait<POLL_DIVIDER;
195 private final String sid() {
return "0x"+Integer.toHexString(hashCode()); }
199 if(
null != sharedGears && !sharedGears.isInit() ) {
201 System.err.println(Thread.currentThread()+
" GearsES2.init.0 "+sid()+
": pending shared Gears .. re-init later XXXXX");
209 System.err.println(Thread.currentThread()+
" GearsES2.init.0 "+sid()+
": tileRendererInUse "+tileRendererInUse+
", "+
this);
210 System.err.println(
"GearsES2 init "+sid()+
" on "+Thread.currentThread());
212 System.err.println(
"INIT GL IS: " + gl.getClass().getName());
216 System.err.println(
"No GLSL available, no rendering.");
223 "shader/bin",
"gears",
true);
225 "shader/bin",
"gears",
true);
229 sp0.
add(gl, vp0, System.err);
230 sp0.
add(gl, fp0, System.err);
239 st.
uniform(gl, pmvMatrixUniform);
249 if(
null != sharedGears ) {
253 usesSharedGears =
true;
255 System.err.println(
"gear1 "+sid()+
" created w/ share: "+sharedGears.
getGear1()+
" -> "+gear1);
256 System.err.println(
"gear2 "+sid()+
" created w/ share: "+sharedGears.
getGear2()+
" -> "+gear2);
257 System.err.println(
"gear3 "+sid()+
" created w/ share: "+sharedGears.
getGear3()+
" -> "+gear3);
260 syncObjects = sharedGears;
264 }
else if(
null == syncObjects ) {
265 syncObjects =
new Object();
267 System.err.println(
"Shared GearsES2: Unsynchronized Objects");
271 gear1 =
new GearsObjectES2(gl, useMappedBuffers, st, gear1Color, 1.0f, 4.0f, 1.0f, 20, 0.7f, pmvMatrix, pmvMatrixUniform, colorU, validateBuffers);
273 System.err.println(
"gear1 "+sid()+
" created: "+gear1);
276 gear2 =
new GearsObjectES2(gl, useMappedBuffers, st, gear2Color, 0.5f, 2.0f, 2.0f, 10, 0.7f, pmvMatrix, pmvMatrixUniform, colorU, validateBuffers);
278 System.err.println(
"gear2 "+sid()+
" created: "+gear2);
281 gear3 =
new GearsObjectES2(gl, useMappedBuffers, st, gear3Color, 1.3f, 2.0f, 0.5f, 10, 0.7f, pmvMatrix, pmvMatrixUniform, colorU, validateBuffers);
283 System.err.println(
"gear3 "+sid()+
" created: "+gear2);
285 if(
null == syncObjects ) {
286 syncObjects =
new Object();
291 if (upstreamWidget instanceof
Window) {
298 }
else if (
GLProfile.isAWTAvailable() && upstreamWidget instanceof java.awt.Component) {
299 final java.awt.Component comp = (java.awt.Component) upstreamWidget;
300 new com.jogamp.newt.event.awt.AWTMouseAdapter(
gearsMouse, drawable).addTo(comp);
301 new com.jogamp.newt.event.awt.AWTKeyAdapter(
gearsKeys, drawable).addTo(comp);
310 System.err.println(Thread.currentThread()+
" GearsES2.init.X "+sid()+
" FIN "+
this);
320 final float zoom = ze.getZoom();
321 panZ = zoom * 30f - 30f;
327 if( !isInit ) {
return; }
330 reshapeImpl(gl, x, y, width, height, width, height);
335 final int tileX,
final int tileY,
final int tileWidth,
final int tileHeight,
336 final int imageWidth,
final int imageHeight) {
337 if( !isInit ) {
return; }
340 reshapeImpl(gl, tileX, tileY, tileWidth, tileHeight, imageWidth, imageHeight);
343 private float zNear = 5f;
344 private float zFar = 10000f;
345 private float zViewDist = 40.0f;
347 public void setZ(
final float zNear,
final float zFar,
final float zViewDist) {
350 this.zViewDist = zViewDist;
353 void reshapeImpl(
final GL2ES2 gl,
final int tileX,
final int tileY,
final int tileWidth,
final int tileHeight,
final int imageWidth,
final int imageHeight) {
356 System.err.println(Thread.currentThread()+
" GearsES2.reshape "+sid()+
" "+tileX+
"/"+tileY+
" "+tileWidth+
"x"+tileHeight+
" of "+imageWidth+
"x"+imageHeight+
", swapInterval "+swapInterval+
", drawable 0x"+Long.toHexString(gl.
getContext().
getGLDrawable().
getHandle())+
", msaa "+msaa+
", tileRendererInUse "+tileRendererInUse);
364 float left, right, bottom, top;
365 if( imageHeight > imageWidth ) {
366 final float a = (float)imageHeight / (
float)imageWidth;
372 final float a = (float)imageWidth / (
float)imageHeight;
378 final float w = right - left;
379 final float h = top - bottom;
382 final float l = left + tileX * w / imageWidth;
383 final float r = l + tileWidth * w / imageWidth;
384 final float b = bottom + tileY * h / imageHeight;
385 final float t = b + tileHeight * h / imageHeight;
387 final float _w = r - l;
388 final float _h = t - b;
390 System.err.println(
">> GearsES2 "+sid()+
", angle "+angle+
", [l "+left+
", r "+right+
", b "+bottom+
", t "+top+
"] "+w+
"x"+h+
" -> [l "+l+
", r "+r+
", b "+b+
", t "+t+
"] "+_w+
"x"+_h+
", v-flip "+flipVerticalInGLOrientation);
398 pmvMatrix.
glFrustumf(l, r, b, t, zNear, zFar);
404 st.
uniform(gl, pmvMatrixUniform);
409 private final Matrix4f mat4Tmp1 =
new Matrix4f();
410 private final Matrix4f mat4Tmp2 =
new Matrix4f();
411 private final Vec3f vec3Tmp1 =
new Vec3f();
412 private final Vec3f vec3Tmp2 =
new Vec3f();
413 private final Vec3f vec3Tmp3 =
new Vec3f();
415 private static final float scalePos = 20f;
429 mat4Tmp1.setToScale(1f, -1f, 1f);
430 mat4Tmp2.setToPerspective(eyeParam.
fovhv, zNear, zFar);
431 mat4.
mul(mat4Tmp1, mat4Tmp2);
447 shiftedEyePos.
scale(scalePos);
453 final Vec3f center = forward.
add(shiftedEyePos);
459 mat4.
translate(0, 0, -zViewDist, mat4Tmp1);
463 st.
uniform(gl, pmvMatrixUniform);
469 if( !isInit ) {
return; }
472 System.err.println(Thread.currentThread()+
" GearsES2.dispose "+sid()+
": tileRendererInUse "+tileRendererInUse);
475 if (upstreamWidget instanceof
Window) {
480 pinchToZoomGesture =
null;
502 System.err.println(Thread.currentThread()+
" GearsES2.dispose "+sid()+
" FIN");
513 if( !isInit ) {
return; }
514 if(
null != sharedGears && !sharedGears.isInit() ) {
return; }
516 if( verbose && (
null == anim || !anim.
isAnimating() ) ) {
517 System.err.println(Thread.currentThread()+
" GearsES2.display "+sid()+
" "+drawable.
getSurfaceWidth()+
"x"+drawable.
getSurfaceHeight()+
", swapInterval "+swapInterval+
", drawable 0x"+Long.toHexString(drawable.
getHandle()));
520 final boolean repeatedFrame = 0 != ( CustomGLEventListener.DISPLAY_REPEAT & flags );
521 final boolean dontClear = 0 != ( CustomGLEventListener.DISPLAY_DONTCLEAR & flags );
524 if( doRotate && !repeatedFrame ) {
531 final boolean hasFocus;
539 if( clearBuffers && !dontClear ) {
540 if(
null != clearColor ) {
541 gl.
glClearColor(clearColor[0], clearColor[1], clearColor[2], clearColor[3]);
542 }
else if(
null != tileRendererInUse ) {
544 }
else if( ignoreFocus || hasFocus ) {
552 (drawable instanceof com.jogamp.opengl.awt.GLJPanel) &&
553 !((com.jogamp.opengl.awt.GLJPanel) drawable).isOpaque() &&
554 ((com.jogamp.opengl.awt.GLJPanel) drawable).shouldPreserveColorBufferIfTranslucent()) {
569 pmvMatrix.
glRotatef(view_rotx, 1.0f, 0.0f, 0.0f);
570 pmvMatrix.
glRotatef(view_roty, 0.0f, 1.0f, 0.0f);
571 pmvMatrix.
glRotatef(view_rotz, 0.0f, 0.0f, 1.0f);
573 synchronized ( syncObjects ) {
574 gear1.draw(gl, -3.0f, -2.0f, 1f * angle - 0f);
575 gear2.draw(gl, 3.1f, -2.0f, -2f * angle - 9.0f);
576 gear3.draw(gl, -3.1f, 4.2f, -2f * angle - 25.0f);
602 return "GearsES2[obj "+sid()+
" isInit "+isInit+
", usesShared "+usesSharedGears+
", 1 "+gear1+
", 2 "+gear2+
", 3 "+gear3+
", sharedGears "+sharedGears+
"]";
607 public void keyPressed(
final KeyEvent e) {
611 }
else if(KeyEvent.VK_RIGHT == kc) {
613 }
else if(KeyEvent.VK_UP == kc) {
615 }
else if(KeyEvent.VK_DOWN == kc) {
621 class GearsMouseAdapter
implements MouseListener{
622 private int prevMouseX, prevMouseY;
625 public void mouseClicked(
final MouseEvent e) {
629 public void mouseEntered(
final MouseEvent e) {
633 public void mouseExited(
final MouseEvent e) {
637 public void mouseWheelMoved(
final MouseEvent e) {
638 final float[] rot = e.getRotation();
639 if( e.isControlDown() ) {
641 final float incr = e.isShiftDown() ? rot[0] : rot[1] * 0.5f ;
643 System.err.println(
"panZ.2: incr "+incr+
", dblZoom "+e.isShiftDown()+
" -> "+panZ);
652 public void mousePressed(
final MouseEvent e) {
653 if( e.getPointerCount()==1 ) {
654 prevMouseX = e.getX();
655 prevMouseY = e.getY();
656 }
else if( e.getPointerCount() == 4 ) {
657 final Object src = e.getSource();
658 if( e.getPressure(0,
true) > 0.7f && src instanceof Window) {
659 ((Window) src).setKeyboardVisible(
true);
665 public void mouseReleased(
final MouseEvent e) {
669 public void mouseMoved(
final MouseEvent e) {
670 if( e.isConfined() ) {
675 prevMouseX = e.getX();
676 prevMouseY = e.getY();
681 public void mouseDragged(
final MouseEvent e) {
685 private void navigate(
final MouseEvent e) {
686 final int x = e.getX();
687 final int y = e.getY();
690 final Object source = e.getSource();
691 Window window =
null;
692 if(source instanceof Window) {
693 window = (Window) source;
694 width=window.getSurfaceWidth();
695 height=window.getSurfaceHeight();
696 }
else if (source instanceof GLAutoDrawable) {
697 final GLAutoDrawable glad = (GLAutoDrawable) source;
698 width = glad.getSurfaceWidth();
699 height = glad.getSurfaceHeight();
700 }
else if (GLProfile.isAWTAvailable() && source instanceof java.awt.Component) {
701 final java.awt.Component comp = (java.awt.Component) source;
702 width=comp.getWidth();
703 height=comp.getHeight();
705 throw new RuntimeException(
"Event source neither Window nor Component: "+source);
707 final float thetaY = 360.0f * ( (float)(x-prevMouseX)/(float)width);
708 final float thetaX = 360.0f * ( (float)(prevMouseY-y)/(float)height);
Basic 4x4 float matrix implementation using fields for intensive use-cases (host operations).
final Matrix4f mul(final Matrix4f b)
Multiply matrix: [this] = [this] x [b].
final Matrix4f translate(final float x, final float y, final float z, final Matrix4f tmp)
Translate this matrix, i.e.
Matrix4f setToPerspective(final float fovy_rad, final float aspect, final float zNear, final float zFar)
Set this matrix to perspective frustum projection.
Matrix4f setToLookAt(final Vec3f eye, final Vec3f center, final Vec3f up, final Matrix4f tmp)
Set this matrix to the look-at matrix based on given parameters.
Quaternion implementation supporting Gimbal-Lock free rotations.
final Vec3f rotateVector(final Vec3f vecIn, final Vec3f vecOut)
final Quaternion mult(final Quaternion q)
Multiply this quaternion by the param quaternion.
3D Vector based upon three float components.
Vec3f scale(final float s)
this = this * s, returns this.
static final Vec3f UNIT_Z_NEG
static final Vec3f UNIT_Y
Vec3f set(final Vec3f o)
this = o, returns this.
Vec3f add(final float dx, final float dy, final float dz)
this = this + { dx, dy, dz }, returns this.
PMVMatrix4f implements the basic computer graphics Matrix4f pack using projection (P),...
static final int INVERSE_TRANSPOSED_MODELVIEW
Bit value for inverse transposed modelview matrix (Mvit), updated via update().
static final int INVERSE_MODELVIEW
Bit value for inverse modelview matrix (Mvi), updated via update().
final SyncMatrices4f getSyncPMvMviMvit()
Returns SyncMatrices4f of 4 matrices within one FloatBuffer: P, Mv, Mvi and Mvit if requested.
static final short VK_LEFT
Constant for the cursor- or numerical-pad left arrow key.
final short getKeyCode()
Returns the virtual key code using a fixed mapping to the US keyboard layout.
A GestureHandler.GestureEvent denominating zoom.
abstract GLDrawable getGLDrawable()
Returns the write-drawable this context uses for framebuffer operations.
final boolean hasRendererQuirk(final int quirk)
Returns true if the quirk exist in getRendererQuirks(), otherwise false.
Specifies the the OpenGL profile.
GLRendererQuirks contains information of known bugs of various GL renderer.
static final int NeedSharedObjectSync
Need GL objects (VBO, ..) to be synchronized when utilized concurrently from multiple threads via a s...
final StringBuilder toString(StringBuilder sb)
static StringBuilder getGLStrings(final GL gl, final StringBuilder sb)
static final FloatBuffer blue
static final FloatBuffer green
void destroy(final GL gl)
static final FloatBuffer red
void removeTileRendererNotify(final TileRendererBase tr)
The owning GLAutoDrawable is detached from the given TileRendererBase instance.
void addTileRendererNotify(final TileRendererBase tr)
The owning GLAutoDrawable is attached to the given TileRendererBase instance.
void init(final GLAutoDrawable drawable)
Called by the drawable immediately after the OpenGL context is initialized.
void setClearBuffers(final boolean v)
void reshape(final GLAutoDrawable glad, final int x, final int y, final int width, final int height)
Called by the drawable during the first repaint after the component has been resized.
void setGearsColors(final FloatBuffer gear1Color, final FloatBuffer gear2Color, final FloatBuffer gear3Color)
void setDoRotation(final boolean rotate)
void setValidateBuffers(final boolean v)
void setSharedGears(final GearsES2 shared)
void display(final GLAutoDrawable drawable, final int flags)
Extended display method, allowing to pass a display flag, e.g.
void startTileRendering(final TileRendererBase tr)
Called by the TileRendererBase during tile-rendering after TileRendererBase#beginTile(GL) and before ...
void setGLStates(final GL2ES2 gl, final boolean enable)
void setFlipVerticalInGLOrientation(final boolean v)
void endTileRendering(final TileRendererBase tr)
Called by the TileRenderer during tile-rendering after TileRendererBase#endTile(GL) and GLAutoDrawabl...
void dispose(final GLAutoDrawable drawable)
Notifies the listener to perform the release of all OpenGL resources per GLContext,...
PMVMatrix4f getPMVMatrix()
GearsObjectES2 getGear1()
GearsObjectES2 getGear2()
void display(final GLAutoDrawable drawable)
Called by the drawable to initiate OpenGL rendering by the client.
GearsES2(final int swapInterval)
boolean waitForInit(final boolean initialized)
void reshapeTile(final TileRendererBase tr, final int tileX, final int tileY, final int tileWidth, final int tileHeight, final int imageWidth, final int imageHeight)
Called by the TileRendererBase during tile-rendering via an attached GLAutoDrawable's GLAutoDrawable#...
void setSyncObjects(final Object sync)
void reshapeForEye(final GLAutoDrawable drawable, final int x, final int y, final int width, final int height, final EyeParameter eyeParam, final ViewerPose viewerPose)
Stereo capable specialization of reshape(GLAutoDrawable, int, int, int, int) for one StereoDeviceRend...
GearsES2 setVerbose(final boolean v)
void setUseMappedBuffers(final boolean v)
void setZ(final float zNear, final float zFar, final float zViewDist)
GearsObjectES2 getGear3()
void setClearColor(final float[] clearColor)
float[4]
void setIgnoreFocus(final boolean v)
boolean usesSharedGears()
PMVMatrix implements a subset of the fixed function pipeline GLMatrixFunc using PMVMatrix4f.
final void glTranslatef(final float x, final float y, final float z)
Translate the current matrix.
final void glScalef(final float x, final float y, final float z)
Scale the current matrix.
final void glMatrixMode(final int matrixName)
Sets the current matrix mode.
final void glPushMatrix()
Push the current matrix to it's stack, while preserving it's values.
final void glFrustumf(final float left, final float right, final float bottom, final float top, final float zNear, final float zFar)
Multiply the current matrix with the frustum matrix.
final void glRotatef(final float ang_deg, final float x, final float y, final float z)
Rotate the current matrix.
final void glPopMatrix()
Pop the current matrix from it's stack.
final void glLoadIdentity()
Load the current matrix with the identity matrix.
final void glLoadMatrixf(final float[] values, final int offset)
Load the current matrix w/ the provided one.
A fairly direct port of Brian Paul's tile rendering library, found at http://www.mesa3d....
final GLAutoDrawable getAttachedDrawable()
Returns a previously attached GLAutoDrawable, null if none is attached.
Convenient shader code class to use and instantiate vertex or fragment programs.
final int defaultShaderCustomization(final GL2ES2 gl, final boolean preludeVersion, final boolean addDefaultPrecision)
Default customization of this shader source code.
static ShaderCode create(final GL2ES2 gl, final int type, final int count, final Class<?> context, final String[] sourceFiles, final boolean mutableStringBuilder)
Creates a complete ShaderCode object while reading all shader source of sourceFiles,...
synchronized void add(final ShaderCode shaderCode)
Adds a new shader to this program.
ShaderState allows to sharing data between shader programs, while updating the attribute and uniform ...
synchronized void useProgram(final GL2ES2 gl, final boolean on)
Turns the shader program on or off.
synchronized boolean attachShaderProgram(final GL2ES2 gl, final ShaderProgram prog, final boolean enable)
Attach or switch a shader program.
final Object attachObject(final String name, final Object obj)
Attach user object for the given name to this ShaderState.
synchronized void destroy(final GL2ES2 gl)
Calls release(gl, true, true, true).
boolean uniform(final GL2ES2 gl, final GLUniformData data)
Set the uniform data, if it's location is valid, i.e.
void ownUniform(final GLUniformData uniform)
Bind the GLUniform lifecycle to this ShaderState.
Constant single eye parameter of the viewer, relative to its ViewerPose.
final float distNoseToPupilX
IPD related horizontal distance from nose to pupil in meter.
final FovHVHalves fovhv
Field of view in both directions, may not be centered, either FovHVHalves#inTangents or radians.
final float distMiddleToPupilY
Vertical distance from middle-line to pupil in meter.
final Vec3f positionOffset
eye position vector used to define eye height in meter relative to actor.
final float eyeReliefZ
Z-axis eye relief in meter.
position and orientation of viewer.
final Quaternion orientation
Orientation of viewer.
final Vec3f position
position of viewer in meter.
Extend the NativeSurface interface with windowing information such as window-handle,...
Specifying NEWT's Window functionality:
void addGestureListener(GestureHandler.GestureListener gl)
Appends the given GestureHandler.GestureListener to the end of the list.
void addKeyListener(KeyListener l)
Appends the given com.jogamp.newt.event.KeyListener to the end of the list.
void removeGestureHandler(GestureHandler gh)
Removes the given GestureHandler from the list.
void removeKeyListener(KeyListener l)
void addMouseListener(MouseListener l)
Appends the given MouseListener to the end of the list.
void removeGestureListener(GestureHandler.GestureListener gl)
Removes the given GestureHandler.GestureListener from the list.
void addGestureHandler(GestureHandler gh)
Appends the given GestureHandler to the end of the list.
void removeMouseListener(MouseListener l)
Removes the given MouseListener from the list.
Listener for GestureEvents.
Generic gesture handler interface designed to allow pass-through filtering of InputEvents.
Listener for MouseEvents.
static final int GL_VERTEX_SHADER
GL_ES_VERSION_2_0, GL_VERSION_2_0, GL_EXT_vertex_shader, GL_ARB_vertex_shader Alias for: GL_VERTEX_SH...
static final int GL_FRAGMENT_SHADER
GL_ES_VERSION_2_0, GL_VERSION_2_0, GL_ATI_fragment_shader, GL_ARB_fragment_shader Alias for: GL_FRAGM...
An animator control interface, which implementation may drive a com.jogamp.opengl....
boolean isAnimating()
Indicates whether this animator is started and is not paused.
A higher-level abstraction than GLDrawable which supplies an event based mechanism (GLEventListener) ...
GLAnimatorControl getAnimator()
GL getGL()
Returns the GL pipeline object this GLAutoDrawable uses.
void setGLEventListenerInitState(GLEventListener listener, boolean initialized)
Sets the given listener's initialized state.
Object getUpstreamWidget()
Method may return the upstream UI toolkit object holding this GLAutoDrawable instance,...
boolean hasGLSL()
Indicates whether this GL object supports GLSL.
GL2ES2 getGL2ES2()
Casts this object to the GL2ES2 interface.
void setSwapInterval(int interval)
Set the swap interval of the current context and attached onscreen GLDrawable.
GLContext getContext()
Returns the GLContext associated which this GL object.
boolean getSampleBuffers()
Returns whether sample buffers for full-scene antialiasing (FSAA) should be allocated for this drawab...
GLCapabilitiesImmutable getChosenGLCapabilities()
Fetches the GLCapabilitiesImmutable corresponding to the chosen OpenGL capabilities (pixel format / v...
int getSurfaceWidth()
Returns the width of this GLDrawable's surface client area in pixel units.
long getHandle()
Returns the GL drawable handle, guaranteed to be valid after realization and while it's surface is be...
boolean isGLOriented()
Returns true if the drawable is rendered in OpenGL's coordinate system, origin at bottom left.
NativeSurface getNativeSurface()
Returns the associated NativeSurface of this NativeSurfaceHolder.
int getSurfaceHeight()
Returns the height of this GLDrawable's surface client area in pixel units.
void glDisable(int cap)
Entry point to C language function: void {@native glDisable}(GLenum cap) Part of GL_ES_VERSION_2_0...
static final int GL_COLOR_BUFFER_BIT
GL_ES_VERSION_2_0, GL_VERSION_1_1, GL_VERSION_1_0, GL_VERSION_ES_1_0 Define "GL_COLOR_BUFFER_BIT" wit...
void glClearColor(float red, float green, float blue, float alpha)
Entry point to C language function: void {@native glClearColor}(GLfloat red, GLfloat green,...
void glEnable(int cap)
Entry point to C language function: void {@native glEnable}(GLenum cap) Part of GL_ES_VERSION_2_0,...
static final int GL_DEPTH_TEST
GL_ES_VERSION_2_0, GL_VERSION_1_1, GL_VERSION_1_0, GL_VERSION_ES_1_0 Define "GL_DEPTH_TEST" with expr...
void glClear(int mask)
Entry point to C language function: void {@native glClear}(GLbitfield mask) Part of GL_ES_VERSION_...
void glFinish()
Entry point to C language function: void {@native glFinish}() Part of GL_ES_VERSION_2_0,...
static final int GL_DEPTH_BUFFER_BIT
GL_ES_VERSION_2_0, GL_VERSION_1_1, GL_VERSION_1_0, GL_VERSION_ES_1_0 Define "GL_DEPTH_BUFFER_BIT" wit...
static final int GL_CULL_FACE
GL_ES_VERSION_2_0, GL_VERSION_1_1, GL_VERSION_1_0, GL_VERSION_ES_1_0 Define "GL_CULL_FACE" with expre...
Subset of OpenGL fixed function pipeline's matrix operations.
static final int GL_PROJECTION
Matrix mode projection.
static final int GL_MODELVIEW
Matrix mode modelview.
Extended GLEventListener and CustomGLEventListener interface supporting stereoscopic client rendering...