21package com.jogamp.opengl.demos.es2;
23import java.nio.FloatBuffer;
25import com.jogamp.opengl.GL;
26import com.jogamp.opengl.GL2ES2;
27import com.jogamp.opengl.GLBufferStorage;
28import com.jogamp.opengl.GLException;
29import com.jogamp.opengl.GLUniformData;
30import com.jogamp.opengl.demos.GearsObject;
31import com.jogamp.opengl.util.GLArrayDataServer;
32import com.jogamp.opengl.util.PMVMatrix;
33import com.jogamp.opengl.util.glsl.ShaderState;
46 final float inner_radius,
final float outer_radius,
52 this.pmvMatrix = pmvMatrix;
53 this.pmvMatrixUniform = pmvMatrixUniform;
54 this.colorUniform = colorUniform;
65 this.pmvMatrix = pmvMatrix;
66 this.pmvMatrixUniform = pmvMatrixUniform;
67 this.colorUniform = colorUniform;
82 public GLArrayDataServer createInterleaved(
final boolean useMappedBuffers,
final int comps,
final int dataType,
final boolean normalized,
final int initialSize,
final int vboUsage) {
83 if( useMappedBuffers ) {
105 final boolean ok = bufferName == hasBufferName &&
106 bufferName == hasStorage.
getName() &&
107 bufferSize == hasStorage.
getSize();
109 throw new GLException(
"GLBufferStorage Validation Error: Target[exp 0x"+Integer.toHexString(bufferTarget)+
", has 0x"+Integer.toHexString(bufferTarget)+
110 ", Name[exp "+bufferName+
", has "+hasBufferName+
", Size exp "+bufferSize+
", Storage "+hasStorage+
"]");
121 public void draw(
final GL _gl,
final float x,
final float y,
final float angle) {
126 st.
uniform(gl, pmvMatrixUniform);
OpenGL buffer storage object reflecting it's.
final int getName()
Return the buffer name.
final long getSize()
Return the buffer's storage size.
A generic exception for OpenGL errors used throughout the binding as a substitute for RuntimeExceptio...
GLArrayDataServer outwardFace
GLArrayDataServer frontFace
GLArrayDataServer backFace
GLArrayDataServer insideRadiusCyl
GLArrayDataServer backSide
final FloatBuffer gearColor
GLArrayDataServer frontSide
GLArrayDataServer createInterleaved(final boolean useMappedBuffers, final int comps, final int dataType, final boolean normalized, final int initialSize, final int vboUsage)
void addInterleavedVertexAndNormalArrays(final GLArrayDataServer array, final int components)
GearsObjectES2(final GL gl, final boolean useMappedBuffers, final ShaderState st, final FloatBuffer gearColor, final float inner_radius, final float outer_radius, final float width, final int teeth, final float tooth_depth, final PMVMatrix pmvMatrix, final GLUniformData pmvMatrixUniform, final GLUniformData colorUniform, final boolean validateBuffers)
void draw(final GL _gl, final float x, final float y, final float angle)
GearsObjectES2(final GearsObjectES2 shared, final ShaderState st, final PMVMatrix pmvMatrix, final GLUniformData pmvMatrixUniform, final GLUniformData colorUniform)
void associate(final Object obj, final boolean enable)
Implementation and type dependent object association.
boolean bindBuffer(final GL gl, final boolean bind)
if bind is true and the data uses VBO, the latter will be bound and data written to the GPU if requir...
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,...
static GLArrayDataServer createGLSLInterleavedMapped(final int compsPerElement, final int dataType, final boolean normalized, final int mappedElementCount, final int vboUsage)
Create a VBO for GLSL interleaved array data intended for GPU buffer storage mapping,...
final int getByteCount()
Returns the byte position (written elements) if not sealed() or the byte limit (available to read) af...
final int getElemCount()
Returns the element position (written elements) if not sealed() or the element limit (available to re...
final int getVBOName()
The VBO name or 0 if not a VBO.
final int getVBOTarget()
The VBO target or 0 if not a VBO.
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 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.
ShaderState allows to sharing data between shader programs, while updating the attribute and uniform ...
boolean uniform(final GL2ES2 gl, final GLUniformData data)
Set the uniform data, if it's location is valid, i.e.
int getBoundBuffer(int target)
GL2ES2 getGL2ES2()
Casts this object to the GL2ES2 interface.
GLBufferStorage getBufferStorage(int bufferName)
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_TRIANGLES
GL_ES_VERSION_2_0, GL_VERSION_1_1, GL_VERSION_1_0, GL_VERSION_ES_1_0 Define "GL_TRIANGLES" with expre...
boolean glIsBuffer(int buffer)
Entry point to C language function: GLboolean {@native glIsBuffer}(GLuint buffer) Part of GL_VERSI...
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_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...