本文整理汇总了Java中com.jogamp.opengl.GL4.glBindBuffer方法的典型用法代码示例。如果您正苦于以下问题:Java GL4.glBindBuffer方法的具体用法?Java GL4.glBindBuffer怎么用?Java GL4.glBindBuffer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.jogamp.opengl.GL4
的用法示例。
在下文中一共展示了GL4.glBindBuffer方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initVertexArray
import com.jogamp.opengl.GL4; //导入方法依赖的package包/类
private void initVertexArray(GL4 gl4) {
// create and bind a VAO to hold state for this model
gl4.glGenVertexArrays(1, vertexArrayName);
gl4.glBindVertexArray(vertexArrayName.get(0));
gl4.glBindBuffer(GL_ARRAY_BUFFER, bufferName.get(Buffer.VERTEX));
// Identify the components in the vertex buffer
gl4.glEnableVertexAttribArray(Semantic.Attr.POSITION);
gl4.glVertexAttribPointer(Semantic.Attr.POSITION, 3, GL_FLOAT, false, RenderModel_Vertex_t.SIZE,
RenderModel_Vertex_t.OFFSET_POSITION);
gl4.glEnableVertexAttribArray(Semantic.Attr.NORMAL);
gl4.glVertexAttribPointer(Semantic.Attr.NORMAL, 3, GL_FLOAT, false, RenderModel_Vertex_t.SIZE,
RenderModel_Vertex_t.OFFSET_NORMAL);
gl4.glEnableVertexAttribArray(Semantic.Attr.TEXT_COORD);
gl4.glVertexAttribPointer(Semantic.Attr.TEXT_COORD, 2, GL_FLOAT, false, RenderModel_Vertex_t.SIZE,
RenderModel_Vertex_t.OFFSET_TEXT_COORD);
gl4.glBindBuffer(GL_ARRAY_BUFFER, 0);
gl4.glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, bufferName.get(Buffer.ELEMENT));
gl4.glBindVertexArray(0);
}
示例2: initVertexArray
import com.jogamp.opengl.GL4; //导入方法依赖的package包/类
private void initVertexArray(GL4 gl4) {
gl4.glGenVertexArrays(1, vertexArrayName);
gl4.glBindVertexArray(vertexArrayName.get(0));
gl4.glBindBuffer(GL_ARRAY_BUFFER, vertexBufferName.get(0));
int stride = 2 * 3 * Float.BYTES;
int offset = 0;
gl4.glEnableVertexAttribArray(Semantic.Attr.POSITION);
gl4.glVertexAttribPointer(Semantic.Attr.POSITION, 3, GL_FLOAT, false, stride, offset);
offset += Vec3.SIZE;
gl4.glEnableVertexAttribArray(Semantic.Attr.COLOR);
gl4.glVertexAttribPointer(Semantic.Attr.COLOR, 3, GL_FLOAT, false, stride, offset);
gl4.glBindBuffer(GL_ARRAY_BUFFER, 0);
gl4.glBindVertexArray(0);
}
示例3: initBuffer
import com.jogamp.opengl.GL4; //导入方法依赖的package包/类
private boolean initBuffer(GL4 gl4) {
FloatBuffer vertexBuffer = GLBuffers.newDirectFloatBuffer(vertexData);
IntBuffer uniformBufferOffset = GLBuffers.newDirectIntBuffer(1);
gl4.glGenBuffers(Buffer.MAX, bufferName);
gl4.glBindBuffer(GL_ARRAY_BUFFER, bufferName.get(Buffer.VERTEX));
gl4.glBufferData(GL_ARRAY_BUFFER, vertexSize, vertexBuffer, GL_STATIC_DRAW);
gl4.glBindBuffer(GL_ARRAY_BUFFER, 0);
gl4.glGetIntegerv(GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT, uniformBufferOffset);
int uniformBlockSize = Math.max(Transform.SIZE, uniformBufferOffset.get(0));
gl4.glBindBuffer(GL_UNIFORM_BUFFER, bufferName.get(Buffer.TRANSFORM));
gl4.glBufferData(GL_UNIFORM_BUFFER, uniformBlockSize, null, GL_DYNAMIC_DRAW);
gl4.glBindBuffer(GL_UNIFORM_BUFFER, 0);
BufferUtils.destroyDirectBuffer(vertexBuffer);
BufferUtils.destroyDirectBuffer(uniformBufferOffset);
return true;
}
示例4: initVertexArray
import com.jogamp.opengl.GL4; //导入方法依赖的package包/类
private boolean initVertexArray(GL4 gl4) {
gl4.glGenVertexArrays(1, vertexArrayName);
gl4.glBindVertexArray(vertexArrayName.get(0));
{
gl4.glBindBuffer(GL_ARRAY_BUFFER, bufferName.get(Buffer.VERTEX));
gl4.glVertexAttribPointer(Semantic.Attr.POSITION, 2, GL_FLOAT, false, Vertex_v2fv2f.SIZE, 0);
gl4.glVertexAttribPointer(Semantic.Attr.TEXCOORD, 2, GL_FLOAT, false, Vertex_v2fv2f.SIZE, Vec2.SIZE);
gl4.glBindBuffer(GL_ARRAY_BUFFER, 0);
gl4.glEnableVertexAttribArray(Semantic.Attr.POSITION);
gl4.glEnableVertexAttribArray(Semantic.Attr.TEXCOORD);
}
gl4.glBindVertexArray(0);
return true;
}
示例5: render
import com.jogamp.opengl.GL4; //导入方法依赖的package包/类
@Override
protected boolean render(GL gl) {
GL4 gl4 = (GL4) gl;
Mat4 projection = glm.perspective_((float) Math.PI * 0.25f, (float) windowSize.x / windowSize.y, 0.1f, 100.0f);
Mat4 model = new Mat4(1.0f);
Mat4 mvp = projection.mul(viewMat4()).mul(model);
gl4.glViewport(0, 0, windowSize.x, windowSize.y);
gl4.glClearBufferfv(GL_DEPTH, 0, clearDepth.put(0, 1));
gl4.glClearBufferfv(GL_COLOR, 0, clearColor.put(0, 1).put(1, 1).put(2, 1).put(3, 1));
gl4.glUseProgram(programName);
gl4.glUniformMatrix4fv(uniformMvp, 1, false, mvp.toFa_(), 0);
gl4.glUniform4f(uniformDiffuse, 1.0f, 0.5f, 0.0f, 1.0f);
gl4.glBindVertexArray(vertexArrayName.get(0));
gl4.glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, bufferName.get(Buffer.ELEMENT));
gl4.glDrawElementsInstancedBaseVertex(GL_TRIANGLES, elementCount, GL_UNSIGNED_SHORT, 0, 1, 0);
return true;
}
示例6: initVertexArray
import com.jogamp.opengl.GL4; //导入方法依赖的package包/类
private boolean initVertexArray(GL4 gl4) {
gl4.glGenVertexArrays(1, vertexArrayName);
gl4.glBindVertexArray(vertexArrayName.get(0));
{
gl4.glBindBuffer(GL_ARRAY_BUFFER, bufferName.get(Buffer.VERTEX));
gl4.glVertexAttribPointer(Semantic.Attr.POSITION, 2, GL_FLOAT, false, Vertex_v2fv2f.SIZE, 0);
gl4.glVertexAttribPointer(Semantic.Attr.TEXCOORD, 2, GL_FLOAT, false, Vertex_v2fv2f.SIZE, Vec2.SIZE);
gl4.glBindBuffer(GL_ARRAY_BUFFER, 0);
gl4.glEnableVertexAttribArray(Semantic.Attr.POSITION);
gl4.glEnableVertexAttribArray(Semantic.Attr.TEXCOORD);
gl4.glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, bufferName.get(Buffer.ELEMENT));
}
gl4.glBindVertexArray(0);
return true;
}
示例7: initVertexArray
import com.jogamp.opengl.GL4; //导入方法依赖的package包/类
private boolean initVertexArray(GL4 gl4) {
gl4.glGenVertexArrays(1, vertexArrayName);
gl4.glBindVertexArray(vertexArrayName.get(0));
{
gl4.glBindBuffer(GL_ARRAY_BUFFER, bufferName.get(Buffer.ARRAY));
gl4.glVertexAttribPointer(Semantic.Attr.POSITION, 2, GL_FLOAT, false, glf.Vertex_v2fc4ub.SIZE, 0);
gl4.glVertexAttribPointer(Semantic.Attr.COLOR, 4, GL_UNSIGNED_BYTE, true, glf.Vertex_v2fc4ub.SIZE, Vec2.SIZE);
gl4.glEnableVertexAttribArray(Semantic.Attr.POSITION);
gl4.glEnableVertexAttribArray(Semantic.Attr.COLOR);
gl4.glBindBuffer(GL_ARRAY_BUFFER, 0);
}
gl4.glBindVertexArray(0);
return checkError(gl4, "initVertexArray");
}
示例8: initVertexArray
import com.jogamp.opengl.GL4; //导入方法依赖的package包/类
private boolean initVertexArray(GL4 gl4) {
boolean validated = true;
gl4.glGenVertexArrays(1, vertexArrayName);
gl4.glBindVertexArray(vertexArrayName.get(0));
{
gl4.glBindBuffer(GL_ARRAY_BUFFER, bufferName.get(Buffer.VERTEX));
gl4.glVertexAttribPointer(Semantic.Attr.POSITION, 2, GL_FLOAT, false, 0, 0);
gl4.glEnableVertexAttribArray(Semantic.Attr.POSITION);
}
gl4.glBindVertexArray(0);
return validated;
}
示例9: initBuffer
import com.jogamp.opengl.GL4; //导入方法依赖的package包/类
private boolean initBuffer(GL4 gl4) {
// Generate a buffer object
gl4.glGenBuffers(Buffer.MAX, bufferName);
gl4.glBindBuffer(GL_ARRAY_BUFFER, bufferName.get(Buffer.VERTEX));
FloatBuffer vertexBuffer = GLBuffers.newDirectFloatBuffer(vertexData);
gl4.glBufferStorage(GL_ARRAY_BUFFER, vertexSize, vertexBuffer, 0);
BufferUtils.destroyDirectBuffer(vertexBuffer);
gl4.glBindBuffer(GL_ARRAY_BUFFER, 0);
int[] uniformBufferOffset = {0};
gl4.glGetIntegerv(GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT, uniformBufferOffset, 0);
int uniformBlockSize = Math.max(Mat4.SIZE, uniformBufferOffset[0]);
gl4.glBindBuffer(GL_UNIFORM_BUFFER, bufferName.get(Buffer.TRANSFORM));
gl4.glBufferStorage(GL_UNIFORM_BUFFER, uniformBlockSize, null, GL_MAP_WRITE_BIT | GL_MAP_PERSISTENT_BIT
| GL_MAP_COHERENT_BIT);
gl4.glBindBuffer(GL_UNIFORM_BUFFER, 0);
return checkError(gl4, "initBuffer");
}
示例10: initVertexArray
import com.jogamp.opengl.GL4; //导入方法依赖的package包/类
private boolean initVertexArray(GL4 gl4) {
gl4.glGenVertexArrays(1, vertexArrayName);
gl4.glBindVertexArray(vertexArrayName.get(0));
{
gl4.glBindBuffer(GL_ARRAY_BUFFER, bufferName.get(Buffer.VERTEX));
gl4.glVertexAttribPointer(Semantic.Attr.POSITION, 2, GL_FLOAT, false, glf.Vertex_v2fv2f.SIZE, 0);
gl4.glVertexAttribPointer(Semantic.Attr.TEXCOORD, 2, GL_FLOAT, false, glf.Vertex_v2fv2f.SIZE, Vec2.SIZE);
gl4.glBindBuffer(GL_ARRAY_BUFFER, 0);
gl4.glEnableVertexAttribArray(Semantic.Attr.POSITION);
gl4.glEnableVertexAttribArray(Semantic.Attr.TEXCOORD);
gl4.glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, bufferName.get(Buffer.ELEMENT));
}
gl4.glBindVertexArray(0);
return true;
}
示例11: initBuffer
import com.jogamp.opengl.GL4; //导入方法依赖的package包/类
private boolean initBuffer(GL4 gl4) {
boolean validated = true;
ShortBuffer elementBuffer = GLBuffers.newDirectShortBuffer(elementData);
FloatBuffer vertexBuffer = GLBuffers.newDirectFloatBuffer(vertexData);
gl4.glGenBuffers(Buffer.MAX, bufferName);
gl4.glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, bufferName.get(Buffer.ELEMENT));
gl4.glBufferData(GL_ELEMENT_ARRAY_BUFFER, elementSize, elementBuffer, GL_STATIC_DRAW);
gl4.glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
gl4.glBindBuffer(GL_ARRAY_BUFFER, bufferName.get(Buffer.VERTEX));
gl4.glBufferData(GL_ARRAY_BUFFER, vertexSize, vertexBuffer, GL_STATIC_DRAW);
gl4.glBindBuffer(GL_ARRAY_BUFFER, 0);
gl4.glBindBuffer(GL_UNIFORM_BUFFER, bufferName.get(Buffer.TRANSFORM));
gl4.glBufferData(GL_UNIFORM_BUFFER, Mat4.SIZE, null, GL_DYNAMIC_DRAW);
gl4.glBindBuffer(GL_UNIFORM_BUFFER, 0);
BufferUtils.destroyDirectBuffer(elementBuffer);
BufferUtils.destroyDirectBuffer(vertexBuffer);
return validated;
}
示例12: initVertexArray
import com.jogamp.opengl.GL4; //导入方法依赖的package包/类
private void initVertexArray(GL4 gl4) {
gl4.glGenVertexArrays(1, vertexArrayName);
gl4.glBindVertexArray(vertexArrayName.get(0));
gl4.glBindBuffer(GL_ARRAY_BUFFER, bufferName.get(Buffer.VERTEX));
gl4.glEnableVertexAttribArray(Semantic.Attr.POSITION);
gl4.glVertexAttribPointer(Semantic.Attr.POSITION, 2, GL_FLOAT, false, VertexDataLens.SIZE,
VertexDataLens.OFFSET_POSITION);
gl4.glEnableVertexAttribArray(Semantic.Attr.UV_RED);
gl4.glVertexAttribPointer(Semantic.Attr.UV_RED, 2, GL_FLOAT, false, VertexDataLens.SIZE,
VertexDataLens.OFFSET_TEX_COORD_RED);
gl4.glEnableVertexAttribArray(Semantic.Attr.UV_GREEN);
gl4.glVertexAttribPointer(Semantic.Attr.UV_GREEN, 2, GL_FLOAT, false, VertexDataLens.SIZE,
VertexDataLens.OFFSET_TEX_COORD_GREEN);
gl4.glEnableVertexAttribArray(Semantic.Attr.UV_BLUE);
gl4.glVertexAttribPointer(Semantic.Attr.UV_BLUE, 2, GL_FLOAT, false, VertexDataLens.SIZE,
VertexDataLens.OFFSET_TEX_COORD_BLUE);
gl4.glBindBuffer(GL_ARRAY_BUFFER, 0);
gl4.glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, bufferName.get(Buffer.ELEMENT));
gl4.glBindVertexArray(0);
}
示例13: initVertexArray
import com.jogamp.opengl.GL4; //导入方法依赖的package包/类
private boolean initVertexArray(GL4 gl4) {
gl4.glGenVertexArrays(1, vertexArrayName);
gl4.glBindVertexArray(vertexArrayName.get(0));
{
gl4.glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, bufferName.get(Buffer.ELEMENT));
}
gl4.glBindVertexArray(0);
return true;
}
示例14: initVertexArray
import com.jogamp.opengl.GL4; //导入方法依赖的package包/类
private boolean initVertexArray(GL4 gl4) {
gl4.glGenVertexArrays(1, vertexArrayName);
gl4.glBindVertexArray(vertexArrayName.get(0));
{
gl4.glBindBuffer(GL_ARRAY_BUFFER, bufferName.get(Buffer.VERTEX));
gl4.glVertexAttribPointer(Semantic.Attr.POSITION, 2, GL_FLOAT, false, 0, 0);
gl4.glBindBuffer(GL_ARRAY_BUFFER, 0);
gl4.glEnableVertexAttribArray(Semantic.Attr.POSITION);
}
gl4.glBindVertexArray(0);
return checkError(gl4, "initVertexArray");
}
示例15: initVertexArray
import com.jogamp.opengl.GL4; //导入方法依赖的package包/类
private boolean initVertexArray(GL4 gl4) {
checkError(gl4, "initVertexArray 0");
// Build a vertex array object
gl4.glGenVertexArrays(VertexArray.MAX, vertexArrayName);
gl4.glBindVertexArray(vertexArrayName.get(VertexArray.TRANSFORM_FEEDBACK));
{
gl4.glBindBuffer(GL_ARRAY_BUFFER, bufferName.get(Buffer.TRANSFORM_ARRAY));
gl4.glVertexAttribPointer(Semantic.Attr.POSITION, 4, GL_FLOAT, false, 0, 0);
gl4.glBindBuffer(GL_ARRAY_BUFFER, 0);
gl4.glEnableVertexAttribArray(Semantic.Attr.POSITION);
}
gl4.glBindVertexArray(0);
checkError(gl4, "initVertexArray 1");
// Build a vertex array object
gl4.glBindVertexArray(vertexArrayName.get(VertexArray.FEEDBACK));
{
gl4.glBindBuffer(GL_ARRAY_BUFFER, bufferName.get(Buffer.FEEDBACK));
gl4.glVertexAttribPointer(Semantic.Attr.POSITION, 4, GL_FLOAT, false, 2 * Vec4.SIZE, 0);
gl4.glVertexAttribPointer(Semantic.Attr.COLOR, 4, GL_FLOAT, false, 2 * Vec4.SIZE, Vec4.SIZE);
gl4.glBindBuffer(GL_ARRAY_BUFFER, 0);
gl4.glEnableVertexAttribArray(Semantic.Attr.POSITION);
gl4.glEnableVertexAttribArray(Semantic.Attr.COLOR);
}
gl4.glBindVertexArray(0);
return checkError(gl4, "initVertexArray");
}