28package com.jogamp.graph.ui.shapes;
30import com.jogamp.opengl.GL;
31import com.jogamp.opengl.GL2ES2;
32import com.jogamp.opengl.GLCapabilities;
33import com.jogamp.opengl.GLCapabilitiesImmutable;
34import com.jogamp.opengl.GLContext;
35import com.jogamp.opengl.GLDrawable;
36import com.jogamp.opengl.GLDrawableFactory;
37import com.jogamp.opengl.GLEventListener;
38import com.jogamp.opengl.GLOffscreenAutoDrawable;
39import com.jogamp.graph.curve.Region;
40import com.jogamp.graph.curve.opengl.RegionRenderer;
41import com.jogamp.graph.ui.GraphShape;
42import com.jogamp.opengl.FBObject;
43import com.jogamp.opengl.util.texture.ImageSequence;
44import com.jogamp.opengl.util.texture.Texture;
68 private final boolean useAlpha;
69 private volatile int fboWidth = 200;
70 private volatile int fboHeight = 200;
71 private volatile GLOffscreenAutoDrawable.FBO fboGLAD =
null;
72 private boolean animateGLEL =
false;
75 final int textureUnit,
final GLEventListener glel,
final boolean useAlpha) {
78 this.useAlpha = useAlpha;
87 this.fboHeight = Math.round( 640 *
height /
width );
90 public final void setAnimate(
final boolean v) { animateGLEL = v; }
91 public final boolean getAnimate() {
return animateGLEL; }
93 public final void setFBOSize(
final int fboWidth,
final int fboHeight) {
94 this.fboWidth = fboWidth;
95 this.fboHeight = fboHeight;
109 final boolean got_sz =
null != surfaceSize && 0 < surfaceSize[0] && 0 < surfaceSize[1];
111 if(
null == fboGLAD ) {
128 fboWidth = surfaceSize[0];
129 fboHeight = surfaceSize[1];
133 caps,
null, fboWidth, fboHeight);
138 fboGLAD.addGLEventListener(glel);
141 final FBObject.TextureAttachment texA01 = fboGLAD.getColorbuffer(
GL.
GL_FRONT).getTextureAttachment();
144 fboGLAD.getSurfaceWidth(), fboGLAD.getSurfaceHeight(),
145 fboGLAD.getSurfaceWidth(), fboGLAD.getSurfaceHeight(),
149 }
else if( 0 != fboWidth*fboHeight ) {
150 fboGLAD.setSurfaceSize(fboWidth, fboHeight);
154 }
else if( got_sz && ( fboGLAD.getSurfaceWidth() != surfaceSize[0] || fboGLAD.getSurfaceHeight() != surfaceSize[1] ) ) {
158 fboGLAD.setSurfaceSize(surfaceSize[0], surfaceSize[1]);
162 final FBObject.TextureAttachment texA01 = fboGLAD.getColorbuffer(
GL.
GL_FRONT).getTextureAttachment();
165 fboGLAD.getSurfaceWidth(), fboGLAD.getSurfaceHeight(),
166 fboGLAD.getSurfaceWidth(), fboGLAD.getSurfaceHeight(),
172 }
else if( animateGLEL ) {
176 super.draw(gl, renderer);
Abstract Outline shape representation define the method an OutlineShape(s) is bound and rendered.
static final int AA_RENDERING_MASK
2-pass rendering bit-mask including MSAA_RENDERING_BIT and VBAA_RENDERING_BIT.
final PMVMatrix4f getMatrix()
Borrow the current PMVMatrix4f.
final Recti getViewport(final Recti target)
Copies the current Rect4i viewport in given target and returns it for chaining.
Shape setColor(final float r, final float g, final float b, final float a)
Set base color.
final void markStateDirty()
Marks the rendering state dirty, causing next draw() to notify the Graph region to reselect shader an...
Shape setPressedColorMod(final float r, final float g, final float b, final float a)
Set pressed color, modulating getColor() if isPressed().
final Shape setToggleOnColorMod(final float r, final float g, final float b, final float a)
Set toggle-on color, modulating getColor() if isToggleOn() and setToggleable(boolean).
final Shape setToggleOffColorMod(final float r, final float g, final float b, final float a)
Set toggle-off color, modulating getColor() if !isToggleOn() and setToggleable(boolean).
final int[] getSurfaceSize(final PMVMatrix4f pmv, final Recti viewport, final int[] surfaceSize)
Retrieve surface (view) size in pixels of this shape.
void setAlphaBits(final int alphaBits)
Sets the number of bits requested for the color buffer's alpha component.
Specifies a set of OpenGL capabilities.
void setDoubleBuffered(final boolean enable)
Enables or disables double buffering.
void setFBO(final boolean enable)
Requesting offscreen FBO mode.
final GLProfile getGLProfile()
Returns the GL profile you desire or used by the drawable.
Abstraction for an OpenGL rendering context.
abstract GLDrawable getGLDrawable()
Returns the write-drawable this context uses for framebuffer operations.
abstract GLOffscreenAutoDrawable createOffscreenAutoDrawable(AbstractGraphicsDevice device, GLCapabilitiesImmutable caps, GLCapabilitiesChooser chooser, int width, int height)
Creates a realized GLOffscreenAutoDrawable incl it's offscreen NativeSurface with the given capabilit...
static GLDrawableFactory getFactory(final GLProfile glProfile)
Returns the sole GLDrawableFactory instance.
Simple TextureSequence implementation allowing existing textures or image streams to be used and repl...
int getTextureTarget()
Returns the texture target used by implementation.
void destroy(final GL gl)
final TextureSequence.TextureFrame addFrame(final GL gl, final Texture tex)
int getTextureUnit()
Return the texture unit used to render the current frame.
Represents an OpenGL texture object.
AbstractGraphicsScreen getScreen()
Return the screen this graphics configuration is valid for.
AbstractGraphicsDevice getDevice()
Return the device this graphics configuration is valid for.
AbstractGraphicsConfiguration getGraphicsConfiguration()
Returns the graphics configuration corresponding to this window.
GLContext getContext()
Returns the GLContext associated which this GL object.
Specifies an immutable set of OpenGL capabilities.
An abstraction for an OpenGL rendering target.
GLCapabilitiesImmutable getRequestedGLCapabilities()
Fetches the GLCapabilitiesImmutable corresponding to the user requested OpenGL capabilities (pixel fo...
NativeSurface getNativeSurface()
Returns the associated NativeSurface of this NativeSurfaceHolder.
Declares events which client code can use to manage OpenGL rendering into a GLAutoDrawable.
FBObject based GLOffscreenAutoDrawable specialization
Platform-independent GLAutoDrawable specialization, exposing offscreen functionality.
void setSharedContext(GLContext sharedContext)
Specifies an OpenGL context, which shall be shared by this GLAutoDrawable's GLContext.
static final int GL_FRONT
GL_ES_VERSION_2_0, GL_VERSION_1_1, GL_VERSION_1_0, GL_VERSION_ES_1_0 Define "GL_FRONT" with expressio...