public class ImmModeSink extends Object
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)
.
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.
Modifier and Type | Field and Description |
---|---|
static int |
GL_POLYGON |
static int |
GL_QUAD_STRIP |
static int |
GL_QUADS |
Modifier and Type | Method and Description |
---|---|
static ImmModeSink |
createFixed(int initialElementCount,
int vComps,
int vDataType,
int cComps,
int cDataType,
int nComps,
int nDataType,
int tComps,
int tDataType,
int glBufferUsage)
Uses a GL2ES1, or ES2 fixed function emulation immediate mode sink
|
static ImmModeSink |
createGLSL(int initialElementCount,
int vComps,
int vDataType,
int cComps,
int cDataType,
int nComps,
int nDataType,
int tComps,
int tDataType,
int glBufferUsage,
int shaderProgram)
Uses a GL2ES2 GLSL shader immediate mode sink, utilizing the given shader-program.
|
static ImmModeSink |
createGLSL(int initialElementCount,
int vComps,
int vDataType,
int cComps,
int cDataType,
int nComps,
int nDataType,
int tComps,
int tDataType,
int glBufferUsage,
ShaderState st)
Uses a GL2ES2 GLSL shader immediate mode sink, utilizing the given ShaderState.
|
void |
destroy(GL gl) |
void |
draw(GL gl,
boolean disableBufferAfterDraw) |
void |
draw(GL gl,
Buffer indices,
boolean disableBufferAfterDraw) |
int |
getResizeElementCount()
Returns the additional element count if buffer resize is required.
|
boolean |
getUseVBO() |
void |
glBegin(int mode) |
void |
glColor3b(byte x,
byte y,
byte z) |
void |
glColor3f(float x,
float y,
float z) |
void |
glColor3s(short x,
short y,
short z) |
void |
glColor3ub(byte x,
byte y,
byte z) |
void |
glColor4b(byte x,
byte y,
byte z,
byte a) |
void |
glColor4f(float x,
float y,
float z,
float a) |
void |
glColor4s(short x,
short y,
short z,
short a) |
void |
glColor4ub(byte x,
byte y,
byte z,
byte a) |
void |
glColorv(Buffer v) |
void |
glEnd(GL gl) |
void |
glEnd(GL gl,
boolean immediateDraw) |
void |
glEnd(GL gl,
Buffer indices) |
void |
glNormal3b(byte x,
byte y,
byte z) |
void |
glNormal3f(float x,
float y,
float z) |
void |
glNormal3s(short x,
short y,
short z) |
void |
glNormalv(Buffer v) |
void |
glTexCoord2b(byte x,
byte y) |
void |
glTexCoord2f(float x,
float y) |
void |
glTexCoord2s(short x,
short y) |
void |
glTexCoord3b(byte x,
byte y,
byte z) |
void |
glTexCoord3f(float x,
float y,
float z) |
void |
glTexCoord3s(short x,
short y,
short z) |
void |
glTexCoordv(Buffer v) |
void |
glVertex2b(byte x,
byte y) |
void |
glVertex2f(float x,
float y) |
void |
glVertex2s(short x,
short y) |
void |
glVertex3b(byte x,
byte y,
byte z) |
void |
glVertex3f(float x,
float y,
float z) |
void |
glVertex3s(short x,
short y,
short z) |
void |
glVertexv(Buffer v) |
void |
reset() |
void |
reset(GL gl) |
void |
setResizeElementCount(int v)
Sets the additional element count if buffer resize is required,
defaults to
initialElementCount of factory method. |
String |
toString() |
public static final int GL_QUADS
public static final int GL_QUAD_STRIP
public static final int GL_POLYGON
public static ImmModeSink createFixed(int initialElementCount, int vComps, int vDataType, int cComps, int cDataType, int nComps, int nDataType, int tComps, int tDataType, int glBufferUsage)
initialElementCount
- initial buffer size, if subsequent mutable operations are about to exceed the buffer size, the buffer will grow about the initial size.vComps
- mandatory vertex component count, should be 2, 3 or 4.vDataType
- mandatory vertex data type, e.g. GL.GL_FLOAT
cComps
- optional color component count, may be 0, 3 or 4cDataType
- optional color data type, e.g. GL.GL_FLOAT
nComps
- optional normal component count, may be 0, 3 or 4nDataType
- optional normal data type, e.g. GL.GL_FLOAT
tComps
- optional texture-coordinate component count, may be 0, 2 or 3tDataType
- optional texture-coordinate data type, e.g. GL.GL_FLOAT
glBufferUsage
- VBO usage
parameter for GL.glBufferData(int, long, Buffer, int)
, e.g. GL.GL_STATIC_DRAW
,
set to 0
for no VBO usagepublic static ImmModeSink createGLSL(int initialElementCount, int vComps, int vDataType, int cComps, int cDataType, int nComps, int nDataType, int tComps, int tDataType, int glBufferUsage, ShaderState st)
initialElementCount
- initial buffer size, if subsequent mutable operations are about to exceed the buffer size, the buffer will grow about the initial size.vComps
- mandatory vertex component count, should be 2, 3 or 4.vDataType
- mandatory vertex data type, e.g. GL.GL_FLOAT
cComps
- optional color component count, may be 0, 3 or 4cDataType
- optional color data type, e.g. GL.GL_FLOAT
nComps
- optional normal component count, may be 0, 3 or 4nDataType
- optional normal data type, e.g. GL.GL_FLOAT
tComps
- optional texture-coordinate component count, may be 0, 2 or 3tDataType
- optional texture-coordinate data type, e.g. GL.GL_FLOAT
glBufferUsage
- VBO usage
parameter for GL.glBufferData(int, long, Buffer, int)
, e.g. GL.GL_STATIC_DRAW
,
set to 0
for no VBO usagest
- ShaderState to locate the vertex attributesdraw(GL, boolean)
,
ShaderState.useProgram(GL2ES2, boolean)
,
com.jogamp.opengl.util.glsl.ShaderState#getCurrentShaderState()
public static ImmModeSink createGLSL(int initialElementCount, int vComps, int vDataType, int cComps, int cDataType, int nComps, int nDataType, int tComps, int tDataType, int glBufferUsage, int shaderProgram)
initialElementCount
- initial buffer size, if subsequent mutable operations are about to exceed the buffer size, the buffer will grow about the initial size.vComps
- mandatory vertex component count, should be 2, 3 or 4.vDataType
- mandatory vertex data type, e.g. GL.GL_FLOAT
cComps
- optional color component count, may be 0, 3 or 4cDataType
- optional color data type, e.g. GL.GL_FLOAT
nComps
- optional normal component count, may be 0, 3 or 4nDataType
- optional normal data type, e.g. GL.GL_FLOAT
tComps
- optional texture-coordinate component count, may be 0, 2 or 3tDataType
- optional texture-coordinate data type, e.g. GL.GL_FLOAT
glBufferUsage
- VBO usage
parameter for GL.glBufferData(int, long, Buffer, int)
, e.g. GL.GL_STATIC_DRAW
,
set to 0
for no VBO usageshaderProgram
- shader-program name to locate the vertex attributesdraw(GL, boolean)
,
ShaderState.useProgram(GL2ES2, boolean)
,
com.jogamp.opengl.util.glsl.ShaderState#getCurrentShaderState()
public void destroy(GL gl)
public void reset()
public void reset(GL gl)
public void draw(GL gl, boolean disableBufferAfterDraw)
public void glBegin(int mode)
public final void glEnd(GL gl)
public void glEnd(GL gl, boolean immediateDraw)
public void glVertexv(Buffer v)
public void glNormalv(Buffer v)
public void glColorv(Buffer v)
public void glTexCoordv(Buffer v)
public final void glVertex2f(float x, float y)
public final void glVertex3f(float x, float y, float z)
public final void glNormal3f(float x, float y, float z)
public final void glColor3f(float x, float y, float z)
public final void glColor4f(float x, float y, float z, float a)
public final void glTexCoord2f(float x, float y)
public final void glTexCoord3f(float x, float y, float z)
public final void glVertex2s(short x, short y)
public final void glVertex3s(short x, short y, short z)
public final void glNormal3s(short x, short y, short z)
public final void glColor3s(short x, short y, short z)
public final void glColor4s(short x, short y, short z, short a)
public final void glTexCoord2s(short x, short y)
public final void glTexCoord3s(short x, short y, short z)
public final void glVertex2b(byte x, byte y)
public final void glVertex3b(byte x, byte y, byte z)
public final void glNormal3b(byte x, byte y, byte z)
public final void glColor3b(byte x, byte y, byte z)
public final void glColor3ub(byte x, byte y, byte z)
public final void glColor4b(byte x, byte y, byte z, byte a)
public final void glColor4ub(byte x, byte y, byte z, byte a)
public final void glTexCoord2b(byte x, byte y)
public final void glTexCoord3b(byte x, byte y, byte z)
public boolean getUseVBO()
public int getResizeElementCount()
setResizeElementCount(int)
public void setResizeElementCount(int v)
initialElementCount
of factory method.Copyright 2010 JogAmp Community.