本文整理汇总了Java中com.jogamp.opengl.util.GLBuffers类的典型用法代码示例。如果您正苦于以下问题:Java GLBuffers类的具体用法?Java GLBuffers怎么用?Java GLBuffers使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
GLBuffers类属于com.jogamp.opengl.util包,在下文中一共展示了GLBuffers类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getElementBuffer
import com.jogamp.opengl.util.GLBuffers; //导入依赖的package包/类
private ShortBuffer getElementBuffer(float radius, short rings, short sectors) {
float R = 1f / (float) (rings - 1);
float S = 1f / (float) (sectors - 1);
short r, s;
float x, y, z;
ShortBuffer elementBuffer = GLBuffers.newDirectShortBuffer(rings * sectors * 6);
for (r = 0; r < rings - 1; r++) {
for (s = 0; s < sectors - 1; s++) {
elementBuffer.put((short) (r * sectors + s));
elementBuffer.put((short) (r * sectors + (s + 1)));
elementBuffer.put((short) ((r + 1) * sectors + (s + 1)));
elementBuffer.put((short) ((r + 1) * sectors + (s + 1)));
elementBuffer.put((short) (r * sectors + s));
// elementBuffer.put((short) (r * sectors + (s + 1)));
elementBuffer.put((short) ((r + 1) * sectors + s));
}
}
elementBuffer.position(0);
return elementBuffer;
}
示例2: setupStereoRenderTargets
import com.jogamp.opengl.util.GLBuffers; //导入依赖的package包/类
private boolean setupStereoRenderTargets(GL4 gl4) {
if (hmd == null) {
return false;
}
IntBuffer width = GLBuffers.newDirectIntBuffer(1), height = GLBuffers.newDirectIntBuffer(1);
hmd.GetRecommendedRenderTargetSize.apply(width, height);
renderSize.set(width.get(0), height.get(0));
IntStreamEx.range(VR.EVREye.Max).forEach(eye -> eyeDesc[eye] = new FramebufferDesc(gl4, renderSize));
BufferUtils.destroyDirectBuffer(width);
BufferUtils.destroyDirectBuffer(height);
return true;
}
示例3: initBuffer
import com.jogamp.opengl.util.GLBuffers; //导入依赖的package包/类
private boolean initBuffer(GL4 gl4) {
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);
BufferUtils.destroyDirectBuffer(elementBuffer);
BufferUtils.destroyDirectBuffer(vertexBuffer);
return checkError(gl4, "initArrayBuffer");
}
示例4: initSampler
import com.jogamp.opengl.util.GLBuffers; //导入依赖的package包/类
private boolean initSampler(GL4 gl4) {
FloatBuffer borderColor = GLBuffers.newDirectFloatBuffer(4);
gl4.glGenSamplers(1, samplerName);
gl4.glSamplerParameteri(samplerName.get(0), GL_TEXTURE_MIN_FILTER, GL_NEAREST);
gl4.glSamplerParameteri(samplerName.get(0), GL_TEXTURE_MAG_FILTER, GL_NEAREST);
gl4.glSamplerParameteri(samplerName.get(0), GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
gl4.glSamplerParameteri(samplerName.get(0), GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
gl4.glSamplerParameteri(samplerName.get(0), GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);
gl4.glSamplerParameterfv(samplerName.get(0), GL_TEXTURE_BORDER_COLOR, borderColor);
gl4.glSamplerParameterf(samplerName.get(0), GL_TEXTURE_MIN_LOD, -1000.f);
gl4.glSamplerParameterf(samplerName.get(0), GL_TEXTURE_MAX_LOD, 1000.f);
gl4.glSamplerParameterf(samplerName.get(0), GL_TEXTURE_LOD_BIAS, 0.0f);
gl4.glSamplerParameteri(samplerName.get(0), GL_TEXTURE_COMPARE_MODE, GL_NONE);
gl4.glSamplerParameteri(samplerName.get(0), GL_TEXTURE_COMPARE_FUNC, GL_LEQUAL);
BufferUtils.destroyDirectBuffer(borderColor);
return checkError(gl4, "initSampler");
}
示例5: initBuffer
import com.jogamp.opengl.util.GLBuffers; //导入依赖的package包/类
private boolean initBuffer(GL4 gl4) {
gl4.glGenBuffers(Buffer.MAX, bufferName);
gl4.glBindBuffer(GL_ARRAY_BUFFER, bufferName.get(Buffer.VERTEX));
ByteBuffer vertexBuffer = GLBuffers.newDirectByteBuffer(vertexSize);
for (int i = 0; i < vertexCount; i++) {
vertexData[i].toBB(vertexBuffer, i);
}
vertexBuffer.rewind();
gl4.glBufferData(GL_ARRAY_BUFFER, vertexSize, vertexBuffer, GL_STATIC_DRAW);
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.glBufferData(GL_UNIFORM_BUFFER, uniformBlockSize, null, GL_DYNAMIC_DRAW);
gl4.glBindBuffer(GL_UNIFORM_BUFFER, 0);
return true;
}
示例6: initSampler
import com.jogamp.opengl.util.GLBuffers; //导入依赖的package包/类
private boolean initSampler(GL3 gl3) {
FloatBuffer clearColor = GLBuffers.newDirectFloatBuffer(new float[]{0.0f, 0.0f, 0.0f, 0.0f});
gl3.glGenSamplers(1, samplerName);
gl3.glSamplerParameteri(samplerName.get(0), GL_TEXTURE_MIN_FILTER, GL_NEAREST);
gl3.glSamplerParameteri(samplerName.get(0), GL_TEXTURE_MAG_FILTER, GL_NEAREST);
gl3.glSamplerParameteri(samplerName.get(0), GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
gl3.glSamplerParameteri(samplerName.get(0), GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
gl3.glSamplerParameteri(samplerName.get(0), GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);
gl3.glSamplerParameterfv(samplerName.get(0), GL_TEXTURE_BORDER_COLOR, clearColor);
gl3.glSamplerParameterf(samplerName.get(0), GL_TEXTURE_MIN_LOD, -1000.f);
gl3.glSamplerParameterf(samplerName.get(0), GL_TEXTURE_MAX_LOD, 1000.f);
gl3.glSamplerParameterf(samplerName.get(0), GL_TEXTURE_LOD_BIAS, 0.0f);
gl3.glSamplerParameteri(samplerName.get(0), GL_TEXTURE_COMPARE_MODE, GL_NONE);
gl3.glSamplerParameteri(samplerName.get(0), GL_TEXTURE_COMPARE_FUNC, GL_LEQUAL);
return checkError(gl3, "initSampler");
}
示例7: initBuffer
import com.jogamp.opengl.util.GLBuffers; //导入依赖的package包/类
private boolean initBuffer(GL4 gl4) {
gl4.glGenBuffers(Buffer.MAX, bufferName);
gl4.glBindBuffer(GL_ARRAY_BUFFER, bufferName.get(Buffer.VERTEX));
FloatBuffer vertexBuffer = GLBuffers.newDirectFloatBuffer(vertexData);
gl4.glBufferData(GL_ARRAY_BUFFER, vertexSize, vertexBuffer, GL_STATIC_DRAW);
BufferUtils.destroyDirectBuffer(vertexBuffer);
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);
return true;
}
示例8: initVertexBuffer
import com.jogamp.opengl.util.GLBuffers; //导入依赖的package包/类
private boolean initVertexBuffer(GL4 gl4) {
FloatBuffer vertexBuffer = GLBuffers.newDirectFloatBuffer(vertexData);
IntBuffer elementBuffer = GLBuffers.newDirectIntBuffer(elementData);
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.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);
BufferUtils.destroyDirectBuffer(vertexBuffer);
BufferUtils.destroyDirectBuffer(elementBuffer);
return checkError(gl4, "initArrayBuffer");
}
示例9: initBuffer
import com.jogamp.opengl.util.GLBuffers; //导入依赖的package包/类
private boolean initBuffer(GL3 gl3) {
ShortBuffer elementBuffer = GLBuffers.newDirectShortBuffer(elementData);
FloatBuffer vertexBuffer = GLBuffers.newDirectFloatBuffer(vertexData);
// Generate a buffer object
gl3.glGenBuffers(Buffer.MAX, bufferName);
gl3.glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, bufferName.get(Buffer.ELEMENT));
gl3.glBufferData(GL_ELEMENT_ARRAY_BUFFER, elementSize, elementBuffer, GL_STATIC_DRAW);
gl3.glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
gl3.glBindBuffer(GL_ARRAY_BUFFER, bufferName.get(Buffer.VERTEX));
gl3.glBufferData(GL_ARRAY_BUFFER, vertexSize, vertexBuffer, GL_STATIC_DRAW);
gl3.glBindBuffer(GL_ARRAY_BUFFER, 0);
BufferUtils.destroyDirectBuffer(elementBuffer);
BufferUtils.destroyDirectBuffer(vertexBuffer);
return checkError(gl3, "initBuffer");
}
示例10: initBuffer
import com.jogamp.opengl.util.GLBuffers; //导入依赖的package包/类
private boolean initBuffer(GL4 gl4) {
gl4.glGenBuffers(Buffer.MAX, bufferName);
gl4.glBindBuffer(GL_SHADER_STORAGE_BUFFER, bufferName.get(Buffer.VERTEX));
FloatBuffer positionBuffer = GLBuffers.newDirectFloatBuffer(positionData);
gl4.glBufferData(GL_SHADER_STORAGE_BUFFER, positionSize, positionBuffer, GL_STATIC_DRAW);
BufferUtils.destroyDirectBuffer(positionBuffer);
gl4.glBindBuffer(GL_SHADER_STORAGE_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.glBufferData(GL_UNIFORM_BUFFER, uniformBlockSize, null, GL_DYNAMIC_DRAW);
gl4.glBindBuffer(GL_UNIFORM_BUFFER, 0);
gl4.glBindBuffer(GL_QUERY_BUFFER, bufferName.get(Buffer.QUERY));
gl4.glBufferData(GL_QUERY_BUFFER, Integer.BYTES * queryName.capacity(), null, GL_DYNAMIC_COPY);
// gl4.glBufferData(GL_QUERY_BUFFER, 500, null, GL_DYNAMIC_COPY);
gl4.glBindBuffer(GL_QUERY_BUFFER, 0);
return checkError(gl4, "initBuffer");
}
示例11: initBuffer
import com.jogamp.opengl.util.GLBuffers; //导入依赖的package包/类
private boolean initBuffer(GL4 gl4) {
gl4.glGenBuffers(Buffer.MAX, bufferName);
gl4.glBindBuffer(GL_ARRAY_BUFFER, bufferName.get(Buffer.VERTEX));
FloatBuffer positionBuffer = GLBuffers.newDirectFloatBuffer(positionData);
gl4.glBufferData(GL_ARRAY_BUFFER, positionSize, positionBuffer, GL_STATIC_DRAW);
BufferUtils.destroyDirectBuffer(positionBuffer);
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.glBufferData(GL_UNIFORM_BUFFER, uniformBlockSize, null, GL_DYNAMIC_DRAW);
gl4.glBindBuffer(GL_UNIFORM_BUFFER, 0);
return true;
}
示例12: initBuffer
import com.jogamp.opengl.util.GLBuffers; //导入依赖的package包/类
private boolean initBuffer(GL3 gl3) {
FloatBuffer vertexBuffer = GLBuffers.newDirectFloatBuffer(vertexData);
IntBuffer uniformBufferOffset = GLBuffers.newDirectIntBuffer(1);
gl3.glGenBuffers(Buffer.MAX, bufferName);
gl3.glBindBuffer(GL_ARRAY_BUFFER, bufferName.get(Buffer.VERTEX));
gl3.glBufferData(GL_ARRAY_BUFFER, vertexSize, vertexBuffer, GL_STATIC_DRAW);
gl3.glBindBuffer(GL_ARRAY_BUFFER, 0);
gl3.glGetIntegerv(
GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT,
uniformBufferOffset);
int uniformBlockSize = Math.max(Mat4.SIZE, uniformBufferOffset.get(0));
gl3.glBindBuffer(GL_UNIFORM_BUFFER, bufferName.get(Buffer.TRANSFORM));
gl3.glBufferData(GL_UNIFORM_BUFFER, uniformBlockSize, null, GL_DYNAMIC_DRAW);
gl3.glBindBuffer(GL_UNIFORM_BUFFER, 0);
BufferUtils.destroyDirectBuffer(vertexBuffer);
BufferUtils.destroyDirectBuffer(uniformBufferOffset);
return checkError(gl3, "initBuffer");
}
示例13: initBuffer
import com.jogamp.opengl.util.GLBuffers; //导入依赖的package包/类
private boolean initBuffer(GL4 gl4) {
gl4.glGenBuffers(Buffer.MAX, bufferName, 0);
gl4.glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, bufferName[Buffer.ELEMENT]);
ShortBuffer elementBuffer = GLBuffers.newDirectShortBuffer(elementData);
gl4.glBufferData(GL_ELEMENT_ARRAY_BUFFER, elementSize, elementBuffer, GL_STATIC_DRAW);
BufferUtils.destroyDirectBuffer(elementBuffer);
gl4.glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
gl4.glBindBuffer(GL_SHADER_STORAGE_BUFFER, bufferName[Buffer.VERTEX]);
FloatBuffer vertexBuffer = GLBuffers.newDirectFloatBuffer(vertexData);
gl4.glBufferData(GL_SHADER_STORAGE_BUFFER, vertexSize, vertexBuffer, GL_STATIC_DRAW);
BufferUtils.destroyDirectBuffer(vertexBuffer);
gl4.glBindBuffer(GL_SHADER_STORAGE_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[Buffer.TRANSFORM]);
gl4.glBufferData(GL_UNIFORM_BUFFER, uniformBlockSize, null, GL_DYNAMIC_DRAW);
gl4.glBindBuffer(GL_UNIFORM_BUFFER, 0);
return true;
}
示例14: initSampler
import com.jogamp.opengl.util.GLBuffers; //导入依赖的package包/类
private boolean initSampler(GL4 gl4) {
FloatBuffer borderColorBuffer = GLBuffers.newDirectFloatBuffer(new float[]{0.0f, 0.0f, 0.0f, 0.0f});
gl4.glCreateSamplers(1, samplerName);
gl4.glSamplerParameteri(samplerName.get(0), GL_TEXTURE_MIN_FILTER, GL_NEAREST_MIPMAP_NEAREST);
gl4.glSamplerParameteri(samplerName.get(0), GL_TEXTURE_MAG_FILTER, GL_NEAREST);
gl4.glSamplerParameteri(samplerName.get(0), GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
gl4.glSamplerParameteri(samplerName.get(0), GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
gl4.glSamplerParameteri(samplerName.get(0), GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);
gl4.glSamplerParameterfv(samplerName.get(0), GL_TEXTURE_BORDER_COLOR, borderColorBuffer);
gl4.glSamplerParameterf(samplerName.get(0), GL_TEXTURE_MIN_LOD, -1000.f);
gl4.glSamplerParameterf(samplerName.get(0), GL_TEXTURE_MAX_LOD, 1000.f);
gl4.glSamplerParameterf(samplerName.get(0), GL_TEXTURE_LOD_BIAS, 0.0f);
gl4.glSamplerParameteri(samplerName.get(0), GL_TEXTURE_COMPARE_MODE, GL_NONE);
gl4.glSamplerParameteri(samplerName.get(0), GL_TEXTURE_COMPARE_FUNC, GL_LEQUAL);
BufferUtils.destroyDirectBuffer(borderColorBuffer);
return true;
}
示例15: initBuffer
import com.jogamp.opengl.util.GLBuffers; //导入依赖的package包/类
private boolean initBuffer(GL4 gl4) {
gl4.glGenBuffers(Buffer.MAX, bufferName);
gl4.glBindBuffer(GL_ARRAY_BUFFER, bufferName.get(Buffer.VERTEX));
FloatBuffer positionBuffer = GLBuffers.newDirectFloatBuffer(positionData);
gl4.glBufferStorage(GL_ARRAY_BUFFER, positionSize, positionBuffer, 0);
BufferUtils.destroyDirectBuffer(positionBuffer);
gl4.glBindBuffer(GL_ARRAY_BUFFER, 0);
gl4.glBindBuffer(GL_ARRAY_BUFFER, bufferName.get(Buffer.FEEDBACK));
gl4.glBufferStorage(GL_ARRAY_BUFFER, glf.Vertex_v4fc4f.SIZE * vertexCount, null, 0);
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 true;
}