Gamp v0.0.7-36-g24b1eb6
Gamp: Graphics, Audio, Multimedia and Processing
Loading...
Searching...
No Matches
gamp::graph::gl::RegionRenderer Class Reference

OpenGL Region renderer. More...

#include <GraphRenderer.hpp>

Collaboration diagram for gamp::graph::gl::RegionRenderer:

Public Member Functions

const void clearHintBits (const int mask)
 
const void destroy (const GL2ES2 gl)
 Deletes all ShaderPrograms and nullifies its references including RenderState#destroy(GL2ES2).
 
const void enable (const GL2ES2 gl, const bool enable)
 Enabling or disabling the RenderState's current shader program.
 
const void enable (const GL2ES2 gl, const bool enable, const GLCallback enableCB, const GLCallback disableCB)
 Same as enable(GL2ES2, bool) but allowing to force GLCallbacks off.
 
const bool equals (const Object other)
 
const int getAAQuality ()
 Returns pass2 AA-quality rendering value for Graph Region AA render-modes: Region#VBAA_RENDERING_BIT.
 
const Frustum getClipFrustum ()
 Returns the optional Mv-premultiplied clipping Frustum or null if unused.
 
const Vec4f getColorStatic (const Vec4f rgbaColor)
 
const int getHeight ()
 Return height of current viewport.
 
const PMVMatrix4f getMatrix ()
 Borrow the current PMVMatrix4f.
 
const RenderState getRenderState ()
 Return the RenderState composition.
 
const int getSampleCount ()
 Returns pass2 AA sample count for Graph Region AA render-modes: VBAA_RENDERING_BIT or Region#MSAA_RENDERING_BIT.
 
const Recti getViewport ()
 Borrows the current Rect4i viewport w/o copying.
 
const Recti getViewport (const Recti target)
 Copies the current Rect4i viewport in given target and returns it for chaining.
 
const float getWeight ()
 
const int getWidth ()
 Return width of current viewport.
 
const int hashCode ()
 
const bool hintBitsSet (const int mask)
 
const void init (const GL2ES2 gl) throws GLException
 Initialize shader and bindings for GPU based rendering bound to the given GL object's GLContext if not initialized yet.
 
const bool isInitialized ()
 
const bool isVBOSupported ()
 
const void reshapeNotify (const int x, const int y, const int width, const int height)
 No PMVMatrix4f operation is performed here.
 
const void reshapeOrtho (const int width, const int height, const float near, const float far)
 Orthogonal projection, method also calls reshapeNotify(int, int, int, int).
 
const void reshapePerspective (const float angle_rad, const int width, const int height, const float near, const float far)
 Perspective projection, method also calls reshapeNotify(int, int, int, int).
 
const int setAAQuality (const int v)
 Sets pass2 AA-quality rendering value clipped to the range [Region#MIN_AA_QUALITY..Region#MAX_AA_QUALITY] for Graph Region AA render-modes: Region#VBAA_RENDERING_BIT.
 
const void setClipFrustum (const Frustum clipFrustum)
 Set the optional clipping Frustum, which shall be pre-multiplied with the Mv-matrix or null to disable.
 
const void setColorStatic (const float r, const float g, const float b, const float a)
 
const void setColorStatic (const Vec4f rgbaColor)
 
const void setHintBits (const int mask)
 
const int setSampleCount (const int v)
 Sets pass2 AA sample count clipped to the range [Region#MIN_AA_SAMPLE_COUNT..Region#MAX_AA_SAMPLE_COUNT] for Graph Region AA render-modes: VBAA_RENDERING_BIT or Region#MSAA_RENDERING_BIT.
 
const void setWeight (const float v)
 
String toString ()
 
const bool useShaderProgram (const GL2ES2 gl, const int renderModes, const bool pass1, const TextureSequence colorTexSeq)
 Generate, selects and caches the desired Curve-Graph ShaderProgram according to the given parameters.
 

Static Public Member Functions

static RegionRenderer create ()
 Create a hardware accelerated RegionRenderer including its RenderState composition.
 
static RegionRenderer create (const GLCallback enableCallback, const GLCallback disableCallback)
 Create a hardware accelerated RegionRenderer including its RenderState composition.
 
static RegionRenderer create (const PMVMatrix4f sharedPMVMatrix, const GLCallback enableCallback, const GLCallback disableCallback)
 Create a hardware accelerated RegionRenderer including its RenderState composition.
 

Static Public Attributes

static const GLCallback defaultBlendDisable
 Default GL#GL_BLEND disable GLCallback, simply turning-off the GL#GL_BLEND state and turning-on depth writing via GL#glDepthMask(bool) if RenderState#BITHINT_GLOBAL_DEPTH_TEST_ENABLED is set.
 
static const GLCallback defaultBlendEnable
 Default GL#GL_BLEND enable GLCallback, turning-off depth writing via GL#glDepthMask(bool) if RenderState#BITHINT_GLOBAL_DEPTH_TEST_ENABLED is set and turning-on the GL#GL_BLEND state.
 

Protected Member Functions

 RegionRenderer (const GLCallback enableCallback, const GLCallback disableCallback)
 
 RegionRenderer (const PMVMatrix4f sharedPMVMatrix, const GLCallback enableCallback, const GLCallback disableCallback)
 

Static Protected Attributes

static const bool DEBUG = Region.DEBUG
 
static const bool DEBUG_ALL_EVENT = Region.DEBUG_ALL_EVENT
 
static const bool DEBUG_INSTANCE = Region.DEBUG_INSTANCE
 

Detailed Description

OpenGL Region renderer.

All Region rendering operations utilize a RegionRenderer.

The RegionRenderer owns its RenderState, a composition.

The RegionRenderer manages and own all used ShaderPrograms, a composition.

At its destruction, all ShaderPrograms and its RenderState will be destroyed and released.

Definition at line 44 of file GraphRenderer.hpp.

Constructor & Destructor Documentation

◆ RegionRenderer() [1/2]

gamp::graph::gl::RegionRenderer::RegionRenderer ( const GLCallback enableCallback,
const GLCallback disableCallback )
inlineprotected

Definition at line 200 of file GraphRenderer.hpp.

Here is the caller graph for this function:

◆ RegionRenderer() [2/2]

gamp::graph::gl::RegionRenderer::RegionRenderer ( const PMVMatrix4f sharedPMVMatrix,
const GLCallback enableCallback,
const GLCallback disableCallback )
inlineprotected

Definition at line 204 of file GraphRenderer.hpp.

Member Function Documentation

◆ create() [1/3]

static RegionRenderer gamp::graph::gl::RegionRenderer::create ( )
inlinestatic

Create a hardware accelerated RegionRenderer including its RenderState composition.

The optional GLCallbacks enableCallback and disableCallback maybe used to issue certain tasks at enable(GL2ES2, bool).
For example, instances defaultBlendEnable and defaultBlendDisable can be utilized to enable and disable GL#GL_BLEND.

Returns
an instance of Region Renderer
See also
enable(GL2ES2, bool)

Definition at line 129 of file GraphRenderer.hpp.

◆ create() [2/3]

static RegionRenderer gamp::graph::gl::RegionRenderer::create ( const GLCallback enableCallback,
const GLCallback disableCallback )
inlinestatic

Create a hardware accelerated RegionRenderer including its RenderState composition.

The optional GLCallbacks enableCallback and disableCallback maybe used to issue certain tasks at enable(GL2ES2, bool).
For example, instances defaultBlendEnable and defaultBlendDisable can be utilized to enable and disable GL#GL_BLEND.

Parameters
enableCallbackoptional GLCallback, if not null will be issued at init(gl) and enable(gl, true).
disableCallbackoptional GLCallback, if not null will be issued at enable(gl, false).
Returns
an instance of Region Renderer
See also
enable(GL2ES2, bool)

Definition at line 148 of file GraphRenderer.hpp.

◆ create() [3/3]

static RegionRenderer gamp::graph::gl::RegionRenderer::create ( const PMVMatrix4f sharedPMVMatrix,
const GLCallback enableCallback,
const GLCallback disableCallback )
inlinestatic

Create a hardware accelerated RegionRenderer including its RenderState composition.

The optional GLCallbacks enableCallback and disableCallback maybe used to issue certain tasks at enable(GL2ES2, bool).
For example, instances defaultBlendEnable and defaultBlendDisable can be utilized to enable and disable GL#GL_BLEND.

Parameters
sharedPMVMatrixoptional shared PMVMatrix4f to be used for the RenderState composition.
enableCallbackoptional GLCallback, if not null will be issued at init(gl) and enable(gl, true).
disableCallbackoptional GLCallback, if not null will be issued at enable(gl, false).
Returns
an instance of Region Renderer
See also
enable(GL2ES2, bool)

Definition at line 168 of file GraphRenderer.hpp.

◆ isInitialized()

const bool gamp::graph::gl::RegionRenderer::isInitialized ( )
inline

Definition at line 182 of file GraphRenderer.hpp.

◆ getViewport() [1/2]

const Recti gamp::graph::gl::RegionRenderer::getViewport ( const Recti target)
inline

Copies the current Rect4i viewport in given target and returns it for chaining.

Definition at line 185 of file GraphRenderer.hpp.

◆ getViewport() [2/2]

const Recti gamp::graph::gl::RegionRenderer::getViewport ( )
inline

Borrows the current Rect4i viewport w/o copying.

Definition at line 190 of file GraphRenderer.hpp.

◆ getWidth()

const int gamp::graph::gl::RegionRenderer::getWidth ( )
inline

Return width of current viewport.

Definition at line 194 of file GraphRenderer.hpp.

◆ getHeight()

const int gamp::graph::gl::RegionRenderer::getHeight ( )
inline

Return height of current viewport.

Definition at line 196 of file GraphRenderer.hpp.

◆ isVBOSupported()

const bool gamp::graph::gl::RegionRenderer::isVBOSupported ( )
inline

Definition at line 219 of file GraphRenderer.hpp.

Here is the caller graph for this function:

◆ init()

const void gamp::graph::gl::RegionRenderer::init ( const GL2ES2 gl) throws GLException
inline

Initialize shader and bindings for GPU based rendering bound to the given GL object's GLContext if not initialized yet.

Disables the renderer via enable(GL2ES2, bool) to remove any side-effects, ie ShaderState incl. shader program.

Shall be called once before at initialization before a draw() method, e.g. RegionRenderer#draw(GL2ES2, Region)

Parameters
glreferencing the current GLContext to which the ShaderState is bound to
Exceptions
GLExceptionif initialization failed

Definition at line 230 of file GraphRenderer.hpp.

◆ destroy()

const void gamp::graph::gl::RegionRenderer::destroy ( const GL2ES2 gl)
inline

Deletes all ShaderPrograms and nullifies its references including RenderState#destroy(GL2ES2).

Definition at line 256 of file GraphRenderer.hpp.

◆ getRenderState()

const RenderState gamp::graph::gl::RegionRenderer::getRenderState ( )
inline

Return the RenderState composition.

Definition at line 282 of file GraphRenderer.hpp.

◆ getMatrix()

const PMVMatrix4f gamp::graph::gl::RegionRenderer::getMatrix ( )
inline

Borrow the current PMVMatrix4f.

Definition at line 289 of file GraphRenderer.hpp.

Here is the caller graph for this function:

◆ getWeight()

const float gamp::graph::gl::RegionRenderer::getWeight ( )
inline

Definition at line 291 of file GraphRenderer.hpp.

◆ setWeight()

const void gamp::graph::gl::RegionRenderer::setWeight ( const float v)
inline

Definition at line 293 of file GraphRenderer.hpp.

◆ getColorStatic()

const Vec4f gamp::graph::gl::RegionRenderer::getColorStatic ( const Vec4f rgbaColor)
inline

Definition at line 295 of file GraphRenderer.hpp.

◆ setColorStatic() [1/2]

const void gamp::graph::gl::RegionRenderer::setColorStatic ( const Vec4f rgbaColor)
inline

Definition at line 297 of file GraphRenderer.hpp.

◆ setColorStatic() [2/2]

const void gamp::graph::gl::RegionRenderer::setColorStatic ( const float r,
const float g,
const float b,
const float a )
inline

Definition at line 299 of file GraphRenderer.hpp.

◆ setAAQuality()

const int gamp::graph::gl::RegionRenderer::setAAQuality ( const int v)
inline

Sets pass2 AA-quality rendering value clipped to the range [Region#MIN_AA_QUALITY..Region#MAX_AA_QUALITY] for Graph Region AA render-modes: Region#VBAA_RENDERING_BIT.

Definition at line 302 of file GraphRenderer.hpp.

◆ getAAQuality()

const int gamp::graph::gl::RegionRenderer::getAAQuality ( )
inline

Returns pass2 AA-quality rendering value for Graph Region AA render-modes: Region#VBAA_RENDERING_BIT.

Definition at line 304 of file GraphRenderer.hpp.

Here is the caller graph for this function:

◆ setSampleCount()

const int gamp::graph::gl::RegionRenderer::setSampleCount ( const int v)
inline

Sets pass2 AA sample count clipped to the range [Region#MIN_AA_SAMPLE_COUNT..Region#MAX_AA_SAMPLE_COUNT] for Graph Region AA render-modes: VBAA_RENDERING_BIT or Region#MSAA_RENDERING_BIT.

Definition at line 307 of file GraphRenderer.hpp.

◆ getSampleCount()

const int gamp::graph::gl::RegionRenderer::getSampleCount ( )
inline

Returns pass2 AA sample count for Graph Region AA render-modes: VBAA_RENDERING_BIT or Region#MSAA_RENDERING_BIT.

Definition at line 309 of file GraphRenderer.hpp.

Here is the caller graph for this function:

◆ setClipFrustum()

const void gamp::graph::gl::RegionRenderer::setClipFrustum ( const Frustum clipFrustum)
inline

Set the optional clipping Frustum, which shall be pre-multiplied with the Mv-matrix or null to disable.

Definition at line 312 of file GraphRenderer.hpp.

◆ getClipFrustum()

const Frustum gamp::graph::gl::RegionRenderer::getClipFrustum ( )
inline

Returns the optional Mv-premultiplied clipping Frustum or null if unused.

Definition at line 314 of file GraphRenderer.hpp.

Here is the caller graph for this function:

◆ hintBitsSet()

const bool gamp::graph::gl::RegionRenderer::hintBitsSet ( const int mask)
inline

Definition at line 316 of file GraphRenderer.hpp.

◆ setHintBits()

const void gamp::graph::gl::RegionRenderer::setHintBits ( const int mask)
inline

Definition at line 318 of file GraphRenderer.hpp.

◆ clearHintBits()

const void gamp::graph::gl::RegionRenderer::clearHintBits ( const int mask)
inline

Definition at line 320 of file GraphRenderer.hpp.

◆ enable() [1/2]

const void gamp::graph::gl::RegionRenderer::enable ( const GL2ES2 gl,
const bool enable )
inline

Enabling or disabling the RenderState's current shader program.

useShaderProgram(GL2ES2, int, bool, TextureSequence) generates, selects and caches the desired Curve-Graph ShaderProgram and sets it current in the RenderState composition.

In case enable and disable GLCallbacks are setup via create(Vertex.Factory<? extends Vertex>, RenderState, GLCallback, GLCallback), they will be called before toggling the shader program.

Parameters
glcurrent GL object
enableif true enable the current ShaderProgram, otherwise disable.
See also
create(Vertex.Factory<? extends Vertex>, RenderState, GLCallback, GLCallback)
useShaderProgram(GL2ES2, int, bool, TextureSequence)
RenderState#setShaderProgram(GL2ES2, ShaderProgram)
RenderState#getShaderProgram()

Definition at line 341 of file GraphRenderer.hpp.

Here is the caller graph for this function:

◆ enable() [2/2]

const void gamp::graph::gl::RegionRenderer::enable ( const GL2ES2 gl,
const bool enable,
const GLCallback enableCB,
const GLCallback disableCB )
inline

Same as enable(GL2ES2, bool) but allowing to force GLCallbacks off.

Parameters
glcurrent GL object
enableif true enable the current ShaderProgram, otherwise disable.
enableCBexplicit GLCallback for enable
disableCBexplicit GLCallback for disable
See also
enable(GL2ES2, bool)

Definition at line 353 of file GraphRenderer.hpp.

◆ reshapeNotify()

const void gamp::graph::gl::RegionRenderer::reshapeNotify ( const int x,
const int y,
const int width,
const int height )
inline

No PMVMatrix4f operation is performed here.

Definition at line 372 of file GraphRenderer.hpp.

Here is the caller graph for this function:

◆ reshapePerspective()

const void gamp::graph::gl::RegionRenderer::reshapePerspective ( const float angle_rad,
const int width,
const int height,
const float near,
const float far )
inline

Perspective projection, method also calls reshapeNotify(int, int, int, int).

Parameters
angle_radperspective angle in radians
widthviewport width
heightviewport height
nearprojection z-near
farprojection z-far

Definition at line 384 of file GraphRenderer.hpp.

◆ reshapeOrtho()

const void gamp::graph::gl::RegionRenderer::reshapeOrtho ( const int width,
const int height,
const float near,
const float far )
inline

Orthogonal projection, method also calls reshapeNotify(int, int, int, int).

Parameters
widthviewport width
heightviewport height
nearprojection z-near
farprojection z-far

Definition at line 399 of file GraphRenderer.hpp.

◆ hashCode()

const int gamp::graph::gl::RegionRenderer::hashCode ( )
inline

Definition at line 547 of file GraphRenderer.hpp.

◆ equals()

const bool gamp::graph::gl::RegionRenderer::equals ( const Object other)
inline

Definition at line 549 of file GraphRenderer.hpp.

◆ toString()

String gamp::graph::gl::RegionRenderer::toString ( )
inline

Definition at line 566 of file GraphRenderer.hpp.

◆ useShaderProgram()

const bool gamp::graph::gl::RegionRenderer::useShaderProgram ( const GL2ES2 gl,
const int renderModes,
const bool pass1,
const TextureSequence colorTexSeq )
inline

Generate, selects and caches the desired Curve-Graph ShaderProgram according to the given parameters.

The newly generated or cached ShaderProgram is set current in the RenderState composition and can be retrieved via RenderState#getShaderProgram().

Parameters
gl
renderModes
pass1
colorTexSeq
Returns
true if a new shader program is being used and hence external uniform-data and -location, as well as the attribute-location must be updated, otherwise false.
See also
enable(GL2ES2, bool)
RenderState#setShaderProgram(GL2ES2, ShaderProgram)
RenderState#getShaderProgram()

Definition at line 639 of file GraphRenderer.hpp.

Member Data Documentation

◆ DEBUG

const bool gamp::graph::gl::RegionRenderer::DEBUG = Region.DEBUG
staticprotected

Definition at line 46 of file GraphRenderer.hpp.

◆ DEBUG_ALL_EVENT

const bool gamp::graph::gl::RegionRenderer::DEBUG_ALL_EVENT = Region.DEBUG_ALL_EVENT
staticprotected

Definition at line 47 of file GraphRenderer.hpp.

◆ DEBUG_INSTANCE

const bool gamp::graph::gl::RegionRenderer::DEBUG_INSTANCE = Region.DEBUG_INSTANCE
staticprotected

Definition at line 48 of file GraphRenderer.hpp.

◆ defaultBlendEnable

const GLCallback gamp::graph::gl::RegionRenderer::defaultBlendEnable
static
Initial value:
= new GLCallback() {
@Override
public void run(const GL gl, const RegionRenderer renderer) {
if( renderer.hintBitsSet(RenderState.BITHINT_GLOBAL_DEPTH_TEST_ENABLED) ) {
gl.glDepthMask(false);
}
gl.glEnable(GL.GL_BLEND);
gl.glBlendEquation(GL.GL_FUNC_ADD);
renderer.setHintBits(RenderState.BITHINT_BLENDING_ENABLED);
}
}
RegionRenderer(const GLCallback enableCallback, const GLCallback disableCallback)

Default GL#GL_BLEND enable GLCallback, turning-off depth writing via GL#glDepthMask(bool) if RenderState#BITHINT_GLOBAL_DEPTH_TEST_ENABLED is set and turning-on the GL#GL_BLEND state.

Implementation also sets RenderState's blending bit-hint, which will cause GLRegion's draw-method to set the proper blend-function and the clear-color to transparent-black in case of multipass FBO rendering.

See also
create(GLCallback, GLCallback)
enable(GL2ES2, bool)

Definition at line 81 of file GraphRenderer.hpp.

◆ defaultBlendDisable

const GLCallback gamp::graph::gl::RegionRenderer::defaultBlendDisable
static
Initial value:
= new GLCallback() {
@Override
public void run(const GL gl, const RegionRenderer renderer) {
renderer.clearHintBits(RenderState.BITHINT_BLENDING_ENABLED);
gl.glDisable(GL.GL_BLEND);
if( renderer.hintBitsSet(RenderState.BITHINT_GLOBAL_DEPTH_TEST_ENABLED) ) {
gl.glDepthMask(true);
}
}
}

Default GL#GL_BLEND disable GLCallback, simply turning-off the GL#GL_BLEND state and turning-on depth writing via GL#glDepthMask(bool) if RenderState#BITHINT_GLOBAL_DEPTH_TEST_ENABLED is set.

Implementation also clears RenderState's blending bit-hint.

See also
create(GLCallback, GLCallback)
enable(GL2ES2, bool)

Definition at line 105 of file GraphRenderer.hpp.


The documentation for this class was generated from the following file: