Top Description Inners Fields Constructors Methods
com.jogamp.opengl.util

public Class ImmModeSink

extends Object
Class Inheritance
Imports
java.nio.Buffer, .ByteBuffer, .IntBuffer, .ShortBuffer, java.util.ArrayList, .Iterator, com.jogamp.opengl.GL, .GL2ES1, .GL2ES2, .GLException, com.jogamp.opengl.fixedfunc.GLPointerFunc, jogamp.opengl.Debug, com.jogamp.common.ExceptionUtils, com.jogamp.common.nio.Buffers, com.jogamp.common.os.Platform, com.jogamp.common.util.PropertyAccess, com.jogamp.opengl.util.glsl.ShaderState

Immediate mode sink, implementing OpenGL fixed function subset of immediate mode operations, i.e.

  glBegin();
    glVertex3f(1f, 1f, 1f);
    glColor4f(1f, 1f, 1f, 1f);
    ...
  glEnd();
Implementation buffers all vertex, colors, normal and texture-coord elements in their respective buffers to be either rendered directly via glEnd(GL) or to be added to an internal display list via glEnd(gl, false) for deferred rendering via draw(GL, boolean).

Buffer storage and it's creation via createFixed(..) and createGLSL(..)

If unsure whether colors, normals and textures will be used, simply add them with an expected component count. This implementation will only render buffers which are being filled.
The buffer growing implementation will only grow the exceeded buffers, unused buffers are not resized.

Note

Optional types, i.e. color, must be either not used or used w/ the same element count as vertex, etc. This is a semantic constraint, same as in the original OpenGL spec.

Nested and Inner Type Summary

Modifier and TypeClass and Description
protected static class

Field Summary

Modifier and TypeField and Description
protected static final boolean
protected static final boolean
protected static final boolean
public static final int
public static final int
public static final int
private ImmModeSink.VBOSet
private final ArrayList<ImmModeSink.VBOSet>

Constructor Summary

AccessConstructor and Description
protected
ImmModeSink(final int initialElementCount, final int vComps, final int vDataType, final int cComps, final int cDataType, final int nComps, final int nDataType, final int tComps, final int tDataType, final boolean useGLSL, final int glBufferUsage, final ShaderState st, final int shaderProgram)

Method Summary

Modifier and TypeMethod and Description
public static ImmModeSink
createFixed(final int
initial buffer size, if subsequent mutable operations are about to exceed the buffer size, the buffer will grow about the initial size.
initialElementCount
,
final int
mandatory vertex component count, should be 2, 3 or 4.
vComps
,
final int
mandatory vertex data type, e.g. GL#GL_FLOAT
vDataType
,
final int
optional color component count, may be 0, 3 or 4
cComps
,
final int
optional color data type, e.g. GL#GL_FLOAT
cDataType
,
final int
optional normal component count, may be 0, 3 or 4
nComps
,
final int
optional normal data type, e.g. GL#GL_FLOAT
nDataType
,
final int
optional texture-coordinate component count, may be 0, 2 or 3
tComps
,
final int
optional texture-coordinate data type, e.g. GL#GL_FLOAT
tDataType
,
final int
VBO usage parameter for GL#glBufferData(int, long, Buffer, int), e.g. GL#GL_STATIC_DRAW, set to 0 for no VBO usage
glBufferUsage
)

Uses a GL2ES1, or ES2 fixed function emulation immediate mode sink

See buffer storage details.

public static ImmModeSink
createGLSL(final int
initial buffer size, if subsequent mutable operations are about to exceed the buffer size, the buffer will grow about the initial size.
initialElementCount
,
final int
mandatory vertex component count, should be 2, 3 or 4.
vComps
,
final int
mandatory vertex data type, e.g. GL#GL_FLOAT
vDataType
,
final int
optional color component count, may be 0, 3 or 4
cComps
,
final int
optional color data type, e.g. GL#GL_FLOAT
cDataType
,
final int
optional normal component count, may be 0, 3 or 4
nComps
,
final int
optional normal data type, e.g. GL#GL_FLOAT
nDataType
,
final int
optional texture-coordinate component count, may be 0, 2 or 3
tComps
,
final int
optional texture-coordinate data type, e.g. GL#GL_FLOAT
tDataType
,
final int
VBO usage parameter for GL#glBufferData(int, long, Buffer, int), e.g. GL#GL_STATIC_DRAW, set to 0 for no VBO usage
glBufferUsage
,
final ShaderState
ShaderState to locate the vertex attributes
st
)

Uses a GL2ES2 GLSL shader immediate mode sink, utilizing the given ShaderState.

public static ImmModeSink
createGLSL(final int
initial buffer size, if subsequent mutable operations are about to exceed the buffer size, the buffer will grow about the initial size.
initialElementCount
,
final int
mandatory vertex component count, should be 2, 3 or 4.
vComps
,
final int
mandatory vertex data type, e.g. GL#GL_FLOAT
vDataType
,
final int
optional color component count, may be 0, 3 or 4
cComps
,
final int
optional color data type, e.g. GL#GL_FLOAT
cDataType
,
final int
optional normal component count, may be 0, 3 or 4
nComps
,
final int
optional normal data type, e.g. GL#GL_FLOAT
nDataType
,
final int
optional texture-coordinate component count, may be 0, 2 or 3
tComps
,
final int
optional texture-coordinate data type, e.g. GL#GL_FLOAT
tDataType
,
final int
VBO usage parameter for GL#glBufferData(int, long, Buffer, int), e.g. GL#GL_STATIC_DRAW, set to 0 for no VBO usage
glBufferUsage
,
final int
shader-program name to locate the vertex attributes
shaderProgram
)

Uses a GL2ES2 GLSL shader immediate mode sink, utilizing the given shader-program.

public void
destroy(final GL gl)

private void
destroyList(final GL gl)

public void
draw(final GL gl, final boolean disableBufferAfterDraw)

public void
draw(final GL gl, final Buffer indices, final boolean disableBufferAfterDraw)

public int
getResizeElementCount()

Returns the additional element count if buffer resize is required.

public boolean
public void
glBegin(int mode)

public final void
glColor3b(final byte x, final byte y, final byte z)

public final void
glColor3f(final float x, final float y, final float z)

public final void
glColor3s(final short x, final short y, final short z)

public final void
glColor3ub(final byte x, final byte y, final byte z)

public final void
glColor4b(final byte x, final byte y, final byte z, final byte a)

public final void
glColor4f(final float x, final float y, final float z, final float a)

public final void
glColor4s(final short x, final short y, final short z, final short a)

public final void
glColor4ub(final byte x, final byte y, final byte z, final byte a)

public void
glColorv(final Buffer v)

public final void
glEnd(final GL gl)

public void
glEnd(final GL gl, final boolean immediateDraw)

public final void
glEnd(final GL gl, final Buffer indices)

private void
glEnd(final GL gl, final Buffer indices, final boolean immediateDraw)

public final void
glNormal3b(final byte x, final byte y, final byte z)

public final void
glNormal3f(final float x, final float y, final float z)

public final void
glNormal3s(final short x, final short y, final short z)

public void
glNormalv(final Buffer v)

public final void
glTexCoord2b(final byte x, final byte y)

public final void
glTexCoord2f(final float x, final float y)

public final void
glTexCoord2s(final short x, final short y)

public final void
glTexCoord3b(final byte x, final byte y, final byte z)

public final void
glTexCoord3f(final float x, final float y, final float z)

public final void
glTexCoord3s(final short x, final short y, final short z)

public void
public final void
glVertex2b(final byte x, final byte y)

public final void
glVertex2f(final float x, final float y)

public final void
glVertex2s(final short x, final short y)

public final void
glVertex3b(final byte x, final byte y, final byte z)

public final void
glVertex3f(final float x, final float y, final float z)

public final void
glVertex3s(final short x, final short y, final short z)

public void
glVertexv(final Buffer v)

public void
public void
reset(final GL gl)

public void
setResizeElementCount(final int v)

Sets the additional element count if buffer resize is required, defaults to initialElementCount of factory method.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait