29package com.jogamp.opengl.demos.av;
31import java.net.URISyntaxException;
32import java.nio.FloatBuffer;
34import com.jogamp.opengl.GL;
35import com.jogamp.opengl.GL2ES2;
36import com.jogamp.opengl.GLAnimatorControl;
37import com.jogamp.opengl.GLAutoDrawable;
38import com.jogamp.opengl.GLES2;
39import com.jogamp.opengl.GLException;
40import com.jogamp.opengl.GLUniformData;
41import com.jogamp.opengl.fixedfunc.GLMatrixFunc;
43import com.jogamp.common.net.Uri;
44import com.jogamp.common.os.Clock;
45import com.jogamp.common.os.Platform;
46import com.jogamp.common.util.InterruptSource;
47import com.jogamp.graph.curve.Region;
48import com.jogamp.graph.curve.opengl.GLRegion;
49import com.jogamp.graph.curve.opengl.RegionRenderer;
50import com.jogamp.graph.font.Font;
51import com.jogamp.graph.font.FontScale;
52import com.jogamp.math.FloatUtil;
53import com.jogamp.math.Matrix4f;
54import com.jogamp.math.Quaternion;
55import com.jogamp.math.Recti;
56import com.jogamp.math.Vec3f;
57import com.jogamp.newt.Window;
58import com.jogamp.newt.event.KeyAdapter;
59import com.jogamp.newt.event.KeyEvent;
60import com.jogamp.newt.event.KeyListener;
61import com.jogamp.newt.event.MouseAdapter;
62import com.jogamp.newt.event.MouseEvent;
63import com.jogamp.newt.event.MouseListener;
64import com.jogamp.newt.opengl.GLWindow;
65import com.jogamp.opengl.GLExtensions;
66import com.jogamp.opengl.GLProfile;
67import com.jogamp.opengl.JoglVersion;
68import com.jogamp.opengl.demos.graph.TextRendererGLELBase;
69import com.jogamp.opengl.demos.util.MiscUtils;
70import com.jogamp.opengl.util.CustomGLEventListener;
71import com.jogamp.opengl.util.GLArrayDataServer;
72import com.jogamp.opengl.util.PMVMatrix;
73import com.jogamp.opengl.util.av.GLMediaPlayer;
74import com.jogamp.opengl.util.av.GLMediaPlayer.GLMediaEventListener;
75import com.jogamp.opengl.util.av.GLMediaPlayerFactory;
76import com.jogamp.opengl.util.glsl.ShaderCode;
77import com.jogamp.opengl.util.glsl.ShaderProgram;
78import com.jogamp.opengl.util.glsl.ShaderState;
79import com.jogamp.opengl.util.stereo.EyeParameter;
80import com.jogamp.opengl.util.stereo.ViewerPose;
81import com.jogamp.opengl.util.stereo.StereoClientRenderer;
82import com.jogamp.opengl.util.stereo.StereoGLEventListener;
83import com.jogamp.opengl.util.texture.Texture;
84import com.jogamp.opengl.util.texture.TextureCoords;
85import com.jogamp.opengl.util.texture.TextureSequence;
86import com.jogamp.opengl.util.texture.TextureSequence.TextureFrame;
99 public static final String
PLAYER =
"player";
101 private static boolean waitForKey =
false;
102 private int surfWidth, surfHeight;
103 private int prevMouseX;
104 private int rotate = 0;
108 private long startTime;
109 private final float alpha = 1.0f;
112 private boolean mPlayerScaleOrig;
113 private float[] verts =
null;
116 private volatile boolean resetGLState =
false;
122 private static final String shaderBasename =
"texsequence_xxx";
123 private static final String myTextureLookupName =
"myTexture2D";
132 _defURI = Uri.cast(
"http://archive.org/download/BigBuckBunny_328/BigBuckBunny_512kb.mp4");
133 }
catch (
final URISyntaxException e) {
140 private final Font font = getFont(0, 0, 0);
141 private final float fontSize = 1f;
144 InfoTextRendererGLELBase(
final GLProfile glp,
final int rmode) {
150 staticRGBAColor[0] = 0.9f;
151 staticRGBAColor[1] = 0.9f;
152 staticRGBAColor[2] = 0.9f;
153 staticRGBAColor[3] = 1.0f;
158 super.init(drawable);
163 if(
null != regionFPS ) {
166 super.dispose(drawable);
170 public void display(
final GLAutoDrawable drawable) {
171 final GLAnimatorControl anim = drawable.getAnimator();
172 final float lfps =
null != anim ? anim.getLastFPS() : 0f;
173 final float tfps =
null != anim ? anim.getTotalFPS() : 0f;
174 final float pts = mPlayer.
getPTS().getCurrent() / 1000f;
178 final int height = 0;
182 final String ptsPrec =
null != regionFPS ?
"3.1" :
"3.0";
183 final String text1 = String.format(
"%0"+ptsPrec+
"f/%0"+ptsPrec+
"f s, %s (%01.2fx, vol %01.2f), a %01.2f, fps %02.1f -> %02.1f / %02.1f",
187 final String text2 = String.format(
"audio: id %d, kbps %d, codec %s",
189 final String text3 = String.format(
"video: id %d, kbps %d, codec %s",
191 final String text4 = mPlayer.
getUri().path.decode();
192 if( displayOSD &&
null != renderer ) {
194 final float pixelSize = FontScale.toPixels(fontSize, dpiH);
195 if(
null != regionFPS ) {
196 final GL2ES2 gl = drawable.getGL().getGL2ES2();
197 renderString(drawable, font, pixelSize, text1, 1 , 1 , 0, 0, -1, regionFPS.
clear(gl));
199 renderString(drawable, font, pixelSize, text1, 1 , 1 , 0, 0, -1,
true);
201 renderString(drawable, font, pixelSize, text2, 1 , -4 , 0, height, -1,
true);
202 renderString(drawable, font, pixelSize, text3, 1 , -3 , 0, height, 0,
true);
203 renderString(drawable, font, pixelSize, text4, 1 , -2 , 0, height, 1,
true);
206 private final boolean enableTextRendererGLEL =
false;
207 private InfoTextRendererGLELBase textRendererGLEL =
null;
208 private boolean displayOSD =
false;
210 private final MouseListener mouseAction =
new MouseAdapter() {
212 public void mousePressed(
final MouseEvent e) {
213 if(e.getY()<=surfHeight/2 &&
null!=mPlayer && 1 == e.getClickCount()) {
214 if(GLMediaPlayer.State.Playing == mPlayer.
getState()) {
215 mPlayer.
pause(
false);
222 public void mouseReleased(
final MouseEvent e) {
223 if(e.getY()<=surfHeight/2) {
226 System.err.println(
"zoom: "+zoom);
230 public void mouseMoved(
final MouseEvent e) {
231 prevMouseX = e.getX();
235 public void mouseDragged(
final MouseEvent e) {
236 final int x = e.getX();
237 final int y = e.getY();
240 final float dp = (float)(x-prevMouseX)/(float)surfWidth;
241 final int pts0 = mPlayer.
getPTS().getCurrent();
253 public void mouseWheelMoved(
final MouseEvent e) {
254 if( !e.isShiftDown() ) {
255 zoom += e.getRotation()[1]/10f;
256 System.err.println(
"zoom: "+zoom);
260 private final KeyListener keyAction =
new KeyAdapter() {
262 public void keyReleased(
final KeyEvent e) {
263 if( e.isAutoRepeat() ) {
266 System.err.println(
"MC "+e);
267 final int pts0 = mPlayer.
getPTS().getCurrent();
269 switch(e.getKeySymbol()) {
270 case KeyEvent.VK_O: displayOSD = !displayOSD;
break;
271 case KeyEvent.VK_RIGHT: pts1 = pts0 + 1000;
break;
272 case KeyEvent.VK_UP: pts1 = pts0 + 10000;
break;
273 case KeyEvent.VK_PAGE_UP: pts1 = pts0 + 30000;
break;
274 case KeyEvent.VK_LEFT: pts1 = pts0 - 1000;
break;
275 case KeyEvent.VK_DOWN: pts1 = pts0 - 10000;
break;
276 case KeyEvent.VK_PAGE_DOWN: pts1 = pts0 - 30000;
break;
277 case KeyEvent.VK_ESCAPE:
278 case KeyEvent.VK_HOME:
279 case KeyEvent.VK_BACK_SPACE: {
283 case KeyEvent.VK_SPACE: {
284 if(GLMediaPlayer.State.Paused == mPlayer.
getState()) {
287 mPlayer.
pause(
false);
291 case KeyEvent.VK_MULTIPLY:
294 case KeyEvent.VK_SUBTRACT: {
296 if( e.isShiftDown() ) {
303 case KeyEvent.VK_ADD: {
305 if( e.isShiftDown() ) {
312 case KeyEvent.VK_M: {
314 if( audioVolume > 0.5f ) {
330 mPlayerScaleOrig =
false;
333 System.out.println(
"pC.1a "+mPlayer);
336 public void initStream(
final Uri streamLoc,
final int vid,
final int aid,
final int textureCount) {
338 System.out.println(
"pC.1b "+mPlayer);
344 mPlayerScaleOrig = v;
348 stereoClientRenderer = scr;
356 private void initShader(
final GL2ES2 gl) {
359 "../shader",
"../shader/bin", shaderBasename,
true);
361 "../shader",
"../shader/bin", shaderBasename,
true);
363 boolean preludeGLSLVersion =
true;
368 if( Platform.OSType.ANDROID == Platform.getOSType() && gl.
isGLES3() ) {
372 preludeGLSLVersion =
false;
385 final StringBuilder sFpIns =
new StringBuilder();
391 final ShaderProgram sp =
new ShaderProgram();
394 if(!sp.link(gl, System.err)) {
395 throw new GLException(
"Couldn't link program: "+sp);
399 st =
new ShaderState();
405 if(
null == mPlayer) {
406 throw new InternalError(
"mPlayer null");
409 throw new IllegalStateException(
"mPlayer in uninitialized state: "+mPlayer);
411 final boolean hasVideo = GLMediaPlayer.STREAM_ID_NONE != mPlayer.
getVID();
412 resetGLState =
false;
421 ", "+drawable.getClass().getName()+
", "+drawable);
428 System.out.println(
"p0 "+mPlayer);
433 System.out.println(
"p1 "+mPlayer);
435 if(
null != frame ) {
437 throw new InternalError(
"XXX: "+mPlayer);
441 throw new InternalError(
"XXX: "+mPlayer);
446 throw new InternalError(
"XXX: "+mPlayer);
449 }
catch (
final Exception glex) {
450 glex.printStackTrace();
451 if(
null != mPlayer) {
466 reshapePMV(viewPort.width(), viewPort.height());
468 if(!st.
uniform(gl, pmvMatrixUniform)) {
469 throw new GLException(
"Error setting PMVMatrix in shader: "+st);
472 throw new GLException(
"Error setting mgl_ActiveTexture in shader: "+st);
477 final float mWidth = mPlayer.
getWidth();
478 final float mHeight = mPlayer.
getHeight();
479 final float mAspect = mWidth/mHeight;
480 System.err.println(
"XXX0: mov aspect: "+mAspect);
482 if(mPlayerScaleOrig && mWidth < dWidth && mHeight < dHeight) {
483 xs = mAspect * ( mWidth / dWidth ) ; ys = xs / mAspect ;
485 xs = mAspect; ys = 1f;
487 verts =
new float[] { -1f*xs, -1f*ys, 0f,
491 System.err.println(
"XXX0: pixel LB: "+verts[0]+
", "+verts[1]+
", "+verts[2]);
492 System.err.println(
"XXX0: pixel RT: "+verts[3]+
", "+verts[4]+
", "+verts[5]);
495 pmvMatrix.
mapObjToWin(
new Vec3f(verts[0], verts[1], verts[2]), viewPort, winLB);
496 pmvMatrix.
mapObjToWin(
new Vec3f(verts[3], verts[4], verts[5]), viewPort, winRT);
497 System.err.println(
"XXX0: win LB: "+winLB);
498 System.err.println(
"XXX0: win RT: "+winRT);
525 System.out.println(
"iVBOLeft : "+interleavedVBOLeft);
526 System.out.println(
"iVBORight: "+interleavedVBORight);
527 System.out.println(st);
531 System.out.println(
"play.0 "+mPlayer);
532 startTime = System.currentTimeMillis();
535 if (upstreamWidget instanceof
Window) {
543 if( enableTextRendererGLEL ) {
544 textRendererGLEL =
new InfoTextRendererGLELBase(gl.
getGLProfile(), rmode);
545 textRendererGLEL.init(drawable);
547 textRendererGLEL =
null;
552 final boolean wasEnabled = iVBO.
enabled();
553 iVBO.
seal(gl,
false);
556 final FloatBuffer ib = (FloatBuffer)iVBO.
getBuffer();
558 final float texHalfWidth = tc.right()/2f;
559 System.err.println(
"XXX0: "+tc+
", texHalfWidth "+texHalfWidth);
564 ib.put(verts[0]); ib.put(verts[1]); ib.put(verts[2]);
565 ib.put( 1); ib.put( 1); ib.put( 1); ib.put(alpha);
567 ib.put( tc.left() ); ib.put( tc.bottom() );
569 ib.put( tc.left() + texHalfWidth ); ib.put( tc.bottom() );
573 ib.put(verts[3]); ib.put(verts[1]); ib.put(verts[2]);
574 ib.put( 1); ib.put( 1); ib.put( 1); ib.put(alpha);
576 ib.put( texHalfWidth ); ib.put( tc.bottom() );
578 ib.put( tc.right() ); ib.put( tc.bottom() );
582 ib.put(verts[0]); ib.put(verts[4]); ib.put(verts[2]);
583 ib.put( 1); ib.put( 1); ib.put( 1); ib.put(alpha);
585 ib.put( tc.left() ); ib.put( tc.top() );
587 ib.put( tc.left() + texHalfWidth ); ib.put( tc.top() );
591 ib.put(verts[3]); ib.put(verts[4]); ib.put(verts[2]);
592 ib.put( 1); ib.put( 1); ib.put( 1); ib.put(alpha);
594 ib.put( texHalfWidth ); ib.put( tc.top() );
596 ib.put( tc.right() ); ib.put( tc.top() );
611 if(
null == mPlayer) {
return; }
614 reshapePMV(width, height);
616 st.
uniform(gl, pmvMatrixUniform);
620 System.out.println(
"pR "+mPlayer);
621 if(
null != textRendererGLEL ) {
622 textRendererGLEL.reshape(drawable, 0, 0, width, height);
626 private final float zNear = 0.1f;
627 private final float zFar = 10000f;
629 private void reshapePMV(
final int width,
final int height) {
639 private final Matrix4f mat4Tmp1 =
new Matrix4f();
640 private final Matrix4f mat4Tmp2 =
new Matrix4f();
641 private final Vec3f vec3Tmp1 =
new Vec3f();
642 private final Vec3f vec3Tmp2 =
new Vec3f();
643 private final Vec3f vec3Tmp3 =
new Vec3f();
647 private static final float scalePos = 4f;
653 interleavedVBOCurrent = 0 == eyeParam.number ? interleavedVBOLeft : interleavedVBORight;
658 if(
null == mPlayer) {
return; }
659 if(
null == st) {
return; }
678 shiftedEyePos.
scale(scalePos);
684 final Vec3f center = forward.
add(shiftedEyePos);
694 st.
uniform(gl, pmvMatrixUniform);
696 if(
null != textRendererGLEL ) {
697 textRendererGLEL.reshape(drawable, 0, 0, width, height);
703 if(
null != textRendererGLEL ) {
704 textRendererGLEL.dispose(drawable);
705 textRendererGLEL =
null;
707 disposeImpl(drawable,
true);
710 private void disposeImpl(
final GLAutoDrawable drawable,
final boolean disposePlayer) {
711 if(
null == mPlayer) {
return; }
714 if (upstreamWidget instanceof Window) {
715 final Window window = (Window) upstreamWidget;
716 window.removeMouseListener(mouseAction);
717 window.removeKeyListener(keyAction);
720 System.out.println(
"pD.1 "+mPlayer+
", disposePlayer "+disposePlayer);
722 if( disposePlayer ) {
724 System.out.println(
"pD.X "+mPlayer);
727 pmvMatrixUniform =
null;
728 if(
null != pmvMatrix) {
737 long lastPerfPos = 0;
747 final boolean repeatedFrame = 0 != ( CustomGLEventListener.DISPLAY_REPEAT & flags );
748 final boolean dontClear = 0 != ( CustomGLEventListener.DISPLAY_DONTCLEAR & flags );
749 final GLArrayDataServer iVBO =
null != interleavedVBOCurrent ? interleavedVBOCurrent : interleavedVBOLeft;
752 if(
null == mPlayer) {
return; }
755 resetGLState =
false;
756 System.err.println(
"XXX resetGLState");
757 disposeImpl(drawable,
false);
762 final long currentPos = System.currentTimeMillis();
763 if( currentPos - lastPerfPos > 2000 ) {
765 lastPerfPos = currentPos;
782 final float ang = ((System.currentTimeMillis() - startTime) * 360.0f) / 8000.0f;
787 st.
uniform(gl, pmvMatrixUniform);
791 final TextureSequence.TextureFrame texFrame;
792 if( repeatedFrame ) {
797 if(
null != texFrame) {
798 tex = texFrame.getTexture();
812 if(
null != textRendererGLEL ) {
813 textRendererGLEL.display(drawable);
818 void destroyWindow(
final Window window) {
819 new InterruptSource.Thread( () -> { window.
destroy(); } ).start();
822 public void attributesChanged(
final GLMediaPlayer mp,
final GLMediaPlayer.EventMask eventMask,
final long when) {
823 System.err.println(
"MovieSimple AttributesChanges: "+eventMask+
", when "+when);
824 System.err.println(
"MovieSimple State: "+mp);
825 final GLWindow window = (GLWindow) mp.getAttachedObject(
WINDOW_KEY);
827 final StereoClientRenderer stereoClientRenderer = (StereoClientRenderer) mp.getAttachedObject(
STEREO_RENDERER_KEY);
829 if( eventMask.isSet(GLMediaPlayer.EventMask.Bit.Size) ) {
833 if( eventMask.isSet(GLMediaPlayer.EventMask.Bit.Init) ) {
836 final GLAnimatorControl anim = window.getAnimator();
837 anim.setUpdateFPSFrames(60,
null);
838 anim.resetFPSCounter();
839 ms.setStereoClientRenderer(stereoClientRenderer);
840 }
else if( eventMask.isSet(GLMediaPlayer.EventMask.Bit.Play) ) {
841 window.getAnimator().resetFPSCounter();
844 boolean destroy =
false;
845 Throwable err =
null;
847 if( eventMask.isSet(GLMediaPlayer.EventMask.Bit.EOS) ) {
848 err = ms.mPlayer.getStreamException();
850 System.err.println(
"MovieSimple State: Exception");
853 new InterruptSource.Thread() {
863 if( eventMask.isSet(GLMediaPlayer.EventMask.Bit.Error) ) {
864 err = ms.mPlayer.getStreamException();
866 System.err.println(
"MovieSimple State: Exception");
872 err.printStackTrace();
874 destroyWindow(window);
Abstract Outline shape representation define the method an OutlineShape(s) is bound and rendered.
static String getRenderModeString(final int renderModes)
Returns a unique technical description string for renderModes as follows:
static final int DEFAULT_AA_SAMPLE_COUNT
Default pass2 AA sample count {@value} for Graph Region AA render-modes: VBAA_RENDERING_BIT or Region...
static final int VBAA_RENDERING_BIT
Rendering-Mode bit for Region.
A GLRegion is the OGL binding of one or more OutlineShapes Defined by its vertices and generated tria...
final GLRegion clear(final GL2ES2 gl)
Clears all buffers, i.e.
final void destroy(final GL2ES2 gl)
Delete and clear the associated OGL objects.
static GLRegion create(final GLProfile glp, int renderModes, final TextureSequence colorTexSeq, final int pass2TexUnit, final int initialVerticesCount, final int initialIndicesCount)
Create a GLRegion using the passed render mode.
static final GLCallback defaultBlendDisable
Default GL#GL_BLEND disable GLCallback, simply turning-off the GL#GL_BLEND state and turning-on depth...
static final GLCallback defaultBlendEnable
Default GL#GL_BLEND enable GLCallback, turning-off depth writing via GL#glDepthMask(boolean) if Rende...
Basic Float math utility functions.
static final float QUARTER_PI
The value PI/4, i.e.
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.
Rectangle with x, y, width and height integer components.
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 add(final float dx, final float dy, final float dz)
this = this + { dx, dy, dz }, returns this.
final SyncMatrices4f getSyncPMv()
Returns SyncMatrices4f of 2 matrices within one FloatBuffer: P and Mv.
final boolean mapObjToWin(final Vec3f objPos, final Recti viewport, final Vec3f winPos)
Map object coordinates to window coordinates.
A generic exception for OpenGL errors used throughout the binding as a substitute for RuntimeExceptio...
Class holding OpenGL extension strings, commonly used by JOGL's implementation.
static final String OES_EGL_image_external
Specifies the the OpenGL profile.
static StringBuilder getGLInfo(final GL gl, final StringBuilder sb)
Side-By-Side (SBS) 3D Movie Player for StereoClientRenderer.
void init(final GLAutoDrawable drawable)
Called by the drawable immediately after the OpenGL context is initialized.
static final StereoGLMediaEventListener stereoGLMediaEventListener
void display(final GLAutoDrawable drawable, final int flags)
Extended display method, allowing to pass a display flag, e.g.
GLMediaPlayer getGLMediaPlayer()
void updateInterleavedVBO(final GL gl, final GLArrayDataServer iVBO, final Texture tex, final int eyeNum)
static final String STEREO_RENDERER_KEY
static final String PLAYER
void reshape(final GLAutoDrawable drawable, 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.
static final Uri defURI
Blender's Big Buck Bunny: 24f 416p H.264, AAC 48000 Hz, 2 ch, mpeg stream.
void initStream(final Uri streamLoc, final int vid, final int aid, final int textureCount)
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...
MovieSBSStereo()
user needs to issue playStream(URI, int, int, int, int) afterwards.
void setStereoClientRenderer(final StereoClientRenderer scr)
static final String WINDOW_KEY
void setScaleOrig(final boolean v)
void dispose(final GLAutoDrawable drawable)
Notifies the listener to perform the release of all OpenGL resources per GLContext,...
StereoClientRenderer getStereoClientRenderer()
void display(final GLAutoDrawable drawable)
Called by the drawable to initiate OpenGL rendering by the client.
void renderString(final GLAutoDrawable drawable, final Font font, final float pixelSize, final CharSequence text, final int column, final float tx, final float ty, final float tz, final boolean cacheRegion)
static void waitForKey(final String preMessage)
void seal(final GL gl, final boolean seal)
Convenience method calling seal(boolean) and enableBuffer(GL, boolean).
void rewind()
Rewinds this buffer.
void enableBuffer(final GL gl, final boolean enable)
Enables the buffer if enable is true, and transfers the data if required.
static GLArrayDataServer createGLSLInterleaved(final int compsPerElement, final int dataType, final boolean normalized, final int initialElementCount, final int vboUsage)
Create a VBO for GLSL interleaved array data starting with a new created Buffer object with initialEl...
GLArrayDataWrapper addGLSLSubArray(final String name, final int comps, final int vboTarget)
Configure a segment of this GLSL interleaved array (see createGLSLInterleaved(int,...
Buffer getBuffer()
The Buffer holding the data, may be null if a GPU buffer without client bound data.
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 glMatrixMode(final int matrixName)
Sets the current matrix mode.
final void gluPerspective(final float fovy_rad, final float aspect, final float zNear, final float zFar)
Multiply the current matrix with the perspective/frustum matrix.
final void glPushMatrix()
Push the current matrix to it's stack, while preserving it's values.
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.
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.
final int addGLSLVersion(final GL2ES2 gl)
Add GLSL version at the head 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,...
int replaceInShaderSource(final String oldName, final String newName)
Replaces oldName with newName in all shader sources.
final int addDefaultShaderPrecision(final GL2ES2 gl, int pos)
Adds default precision to source code at given position if required, i.e.
int insertShaderSource(final int shaderIdx, final String tag, final int fromIndex, final CharSequence data)
Adds data after the line containing tag.
ShaderState allows to sharing data between shader programs, while updating the attribute and uniform ...
void ownAttribute(final GLArrayData attribute, final boolean own)
Binds or unbinds the GLArrayData lifecycle to this ShaderState.
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.
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.
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.
StereoClientRenderer utilizing StereoDeviceRenderer implementing GLEventListener for convenience.
final void addGLEventListener(final StereoGLEventListener l)
position and orientation of viewer.
final Quaternion orientation
Orientation of viewer.
final Vec3f position
position of viewer in meter.
Specifies texture coordinates for a rectangular area of a texture.
Texture holder interface, maybe specialized by implementation to associated related data.
final Texture getTexture()
Represents an OpenGL texture object.
TextureCoords getImageTexCoords()
Returns the set of texture coordinates corresponding to the entire image.
void bind(final GL gl)
Binds this texture to the given GL context.
boolean getMustFlipVertically()
Indicates whether this texture's texture coordinates must be flipped vertically in order to properly ...
void disable(final GL gl)
Disables this texture's target (e.g., GL_TEXTURE_2D) in the given GL state.
float getAspectRatio()
Returns the original aspect ratio of the image, defined as (image width) / (image height),...
void enable(final GL gl)
Enables this texture's target (e.g., GL_TEXTURE_2D) in the given GL context's state.
Interface wrapper for font implementation.
boolean isBackgroundOpaque()
Returns whether an opaque or translucent surface is requested, supported or chosen.
int getSurfaceWidth()
Returns the width of the client area excluding insets (window decorations) in pixel units.
int getSurfaceHeight()
Returns the height of the client area excluding insets (window decorations) in pixel units.
Specifying NEWT's Window functionality:
void addKeyListener(KeyListener l)
Appends the given com.jogamp.newt.event.KeyListener to the end of the list.
void addMouseListener(MouseListener l)
Appends the given MouseListener to the end of the list.
void destroy()
Destroys this window incl.releasing all related resources.
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...
A higher-level abstraction than GLDrawable which supplies an event based mechanism (GLEventListener) ...
GL getGL()
Returns the GL pipeline object this GLAutoDrawable uses.
Object getUpstreamWidget()
Method may return the upstream UI toolkit object holding this GLAutoDrawable instance,...
GL2ES2 getGL2ES2()
Casts this object to the GL2ES2 interface.
GLProfile getGLProfile()
Returns the GLProfile associated with this GL object.
boolean isExtensionAvailable(String glExtensionName)
Returns true if the specified OpenGL extension can be used successfully through this GL instance give...
boolean isGLES3()
Indicates whether this GL object conforms to the OpenGL ES ≥ 3.0 profile.
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.
int getSurfaceHeight()
Returns the height of this GLDrawable's surface client area in pixel units.
static final int GL_TEXTURE_EXTERNAL_OES
GL_OES_EGL_image_external Define "GL_TEXTURE_EXTERNAL_OES" with expression '0x8D65',...
void glDrawArrays(int mode, int first, int count)
Entry point to C language function: void {@native glDrawArrays}(GLenum mode, GLint first,...
static final int GL_STATIC_DRAW
GL_VERSION_1_5, GL_ES_VERSION_2_0, GL_VERSION_ES_1_0, GL_ARB_vertex_buffer_object Alias for: GL_STATI...
static final int GL_FLOAT
GL_ES_VERSION_2_0, GL_VERSION_1_1, GL_VERSION_1_0, GL_VERSION_ES_1_0 Define "GL_FLOAT" with expressio...
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 glActiveTexture(int texture)
Entry point to C language function: void {@native glActiveTexture}(GLenum texture) Part of GL_ES_V...
void glClear(int mask)
Entry point to C language function: void {@native glClear}(GLbitfield mask) Part of GL_ES_VERSION_...
static final int GL_TRIANGLE_STRIP
GL_ES_VERSION_2_0, GL_VERSION_1_1, GL_VERSION_1_0, GL_VERSION_ES_1_0 Define "GL_TRIANGLE_STRIP" with ...
static final int GL_NEAREST
GL_ES_VERSION_2_0, GL_VERSION_1_1, GL_VERSION_1_0, GL_VERSION_ES_1_0 Define "GL_NEAREST" with express...
static final int GL_TEXTURE0
GL_ES_VERSION_2_0, GL_VERSION_1_3, GL_VERSION_ES_1_0, GL_ARB_multitexture Alias for: GL_TEXTURE0_ARB ...
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_ARRAY_BUFFER
GL_VERSION_1_5, GL_ES_VERSION_2_0, GL_VERSION_ES_1_0, GL_ARB_vertex_buffer_object Alias for: GL_ARRAY...
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...
int getTextureTarget()
Returns the texture target used by implementation.
String getTextureLookupFragmentShaderImpl()
Returns the complete texture2D lookup function code of type.
String getTextureSampler2DType()
Returns either sampler2D or samplerExternalOES depending on getLastTexture().
String setTextureLookupFunctionName(String texLookupFuncName)
Set the desired shader code's texture lookup function name.
int getTextureUnit()
Return the texture unit used to render the current frame.
String getRequiredExtensionsShaderStub()
In case a shader extension is required, based on the implementation and the runtime GL profile,...