本文整理汇总了Java中com.jogamp.opengl.util.GLBuffers.newDirectIntBuffer方法的典型用法代码示例。如果您正苦于以下问题:Java GLBuffers.newDirectIntBuffer方法的具体用法?Java GLBuffers.newDirectIntBuffer怎么用?Java GLBuffers.newDirectIntBuffer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.jogamp.opengl.util.GLBuffers
的用法示例。
在下文中一共展示了GLBuffers.newDirectIntBuffer方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
示例2: initFramebuffer
import com.jogamp.opengl.util.GLBuffers; //导入方法依赖的package包/类
private boolean initFramebuffer(GL4 gl4) {
IntBuffer buffers = GLBuffers.newDirectIntBuffer(new int[]{GL_COLOR_ATTACHMENT0});
gl4.glGenFramebuffers(1, framebufferName);
gl4.glBindFramebuffer(GL_FRAMEBUFFER, framebufferName.get(0));
gl4.glFramebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, textureColorbufferName.get(0), 0);
gl4.glDrawBuffers(1, buffers);
if (!isFramebufferComplete(gl4, framebufferName.get(0))) {
return false;
}
gl4.glBindFramebuffer(GL_FRAMEBUFFER, 0);
gl4.glDrawBuffer(GL_BACK);
if (!isFramebufferComplete(gl4, 0)) {
return false;
}
return checkError(gl4, "initFramebuffer");
}
示例3: initBuffer
import com.jogamp.opengl.util.GLBuffers; //导入方法依赖的package包/类
private boolean initBuffer(GL4 gl4) {
gl4.glGenBuffers(Buffer.MAX, bufferName);
FloatBuffer vertexBuffer = GLBuffers.newDirectFloatBuffer(vertexData);
gl4.glBindBuffer(GL_SHADER_STORAGE_BUFFER, bufferName.get(Buffer.VERTEX));
gl4.glBufferStorage(GL_SHADER_STORAGE_BUFFER, vertexSize, vertexBuffer, 0);
gl4.glBindBuffer(GL_SHADER_STORAGE_BUFFER, 0);
IntBuffer uniformBufferOffset = GLBuffers.newDirectIntBuffer(1);
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.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;
}
示例4: initFramebuffer
import com.jogamp.opengl.util.GLBuffers; //导入方法依赖的package包/类
private boolean initFramebuffer(GL4 gl4) {
IntBuffer buffersRender = GLBuffers.newDirectIntBuffer(new int[]{GL_COLOR_ATTACHMENT0});
gl4.glGenFramebuffers(1, framebufferName);
gl4.glBindFramebuffer(GL_FRAMEBUFFER, framebufferName.get(0));
gl4.glFramebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, textureName.get(0), 0);
gl4.glDrawBuffers(1, buffersRender);
if (!isFramebufferComplete(gl4, framebufferName.get(0))) {
return false;
}
gl4.glBindFramebuffer(GL_FRAMEBUFFER, 0);
gl4.glDrawBuffer(GL_BACK);
if (!isFramebufferComplete(gl4, 0)) {
return false;
}
BufferUtils.destroyDirectBuffer(buffersRender);
return checkError(gl4, "initFramebuffer");
}
示例5: 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 true;
}
示例6: 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");
}
示例7: 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");
}
示例8: initTexture
import com.jogamp.opengl.util.GLBuffers; //导入方法依赖的package包/类
private void initTexture(GL3 gl) {
try {
URL texture = getClass().getClassLoader().getResource("images/door.png");
/* Texture data is an object containing all the relevant information about texture. */
TextureData data = TextureIO.newTextureData(gl.getGLProfile(), texture, false, TextureIO.PNG);
int level = 0;
gl.glGenTextures(1, textureName);
gl.glBindTexture(GL_TEXTURE_2D, textureName.get(0));
{
gl.glTexImage2D(GL_TEXTURE_2D,
level,
data.getInternalFormat(),
data.getWidth(), data.getHeight(),
data.getBorder(),
data.getPixelFormat(), data.getPixelType(),
data.getBuffer());
gl.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 0);
gl.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, level);
IntBuffer swizzle = GLBuffers.newDirectIntBuffer(new int[]{GL_RED, GL_GREEN, GL_BLUE, GL_ONE});
gl.glTexParameterIiv(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_RGBA, swizzle);
destroyBuffer(swizzle);
}
gl.glBindTexture(GL_TEXTURE_2D, 0);
} catch (IOException ex) {
Logger.getLogger(HelloTextureK.class.getName()).log(Level.SEVERE, null, ex);
}
}
示例9: initBuffer
import com.jogamp.opengl.util.GLBuffers; //导入方法依赖的package包/类
private boolean initBuffer(GL3 gl3) {
ShortBuffer elementBuffer = GLBuffers.newDirectShortBuffer(elementData);
FloatBuffer vertexBuffer = GLBuffers.newDirectFloatBuffer(vertexData);
IntBuffer uniformBufferOffset = GLBuffers.newDirectIntBuffer(1);
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);
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(elementBuffer);
BufferUtils.destroyDirectBuffer(vertexBuffer);
BufferUtils.destroyDirectBuffer(uniformBufferOffset);
return true;
}
示例10: initBuffer
import com.jogamp.opengl.util.GLBuffers; //导入方法依赖的package包/类
private boolean initBuffer(GL3 gl3) {
ShortBuffer elementBuffer = GLBuffers.newDirectShortBuffer(elementData);
FloatBuffer positionBuffer = GLBuffers.newDirectFloatBuffer(positionData);
IntBuffer uniformBlockSize = GLBuffers.newDirectIntBuffer(1);
// Generate buffer objects
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, positionSize, positionBuffer, GL_STATIC_DRAW);
gl3.glBindBuffer(GL_ARRAY_BUFFER, 0);
{
gl3.glGetActiveUniformBlockiv(
programName,
uniformTransform,
GL_UNIFORM_BLOCK_DATA_SIZE,
uniformBlockSize);
gl3.glBindBuffer(GL_UNIFORM_BUFFER, bufferName.get(Buffer.TRANSFORM));
gl3.glBufferData(GL_UNIFORM_BUFFER, uniformBlockSize.get(0), null, GL_DYNAMIC_DRAW);
gl3.glBindBuffer(GL_UNIFORM_BUFFER, 0);
}
BufferUtils.destroyDirectBuffer(elementBuffer);
BufferUtils.destroyDirectBuffer(positionBuffer);
BufferUtils.destroyDirectBuffer(uniformBlockSize);
return checkError(gl3, "initBuffer");
}
示例11: render
import com.jogamp.opengl.util.GLBuffers; //导入方法依赖的package包/类
@Override
protected boolean render(GL gl) {
GL4 gl4 = (GL4) gl;
{
Mat4 projectionA = glm.perspective_((float) Math.PI * 0.25f, (float) FRAMEBUFFER_SIZE.x / FRAMEBUFFER_SIZE.y,
0.1f, 100.0f).scale(new Vec3(1, -1, 1));
uniformPointer.asFloatBuffer().put(projectionA.mul(viewMat4()).mul(new Mat4(1)).toFa_());
Mat4 projectionB = glm.perspective_((float) Math.PI * 0.25f, (float) windowSize.x / windowSize.y, 0.1f, 100.0f);
uniformPointer.position(uniformBlockSize);
uniformPointer.asFloatBuffer().put(projectionB.mul(viewMat4()).scale(new Vec3(2), new Mat4(1.0f)).toFa_());
}
// Step 1, render the scene in a multisampled framebuffer
gl4.glBindProgramPipeline(pipelineName.get(0));
renderFBO(gl4);
// Step 2: blit
gl4.glBlitNamedFramebuffer(framebufferName.get(Framebuffer.RENDER), framebufferName.get(Framebuffer.RESOLVE),
0, 0, FRAMEBUFFER_SIZE.x, FRAMEBUFFER_SIZE.y,
0, 0, FRAMEBUFFER_SIZE.x, FRAMEBUFFER_SIZE.y,
GL_COLOR_BUFFER_BIT, GL_NEAREST);
IntBuffer maxColorAttachment = GLBuffers.newDirectIntBuffer(new int[]{GL_COLOR_ATTACHMENT0});
gl4.glInvalidateNamedFramebufferData(framebufferName.get(Framebuffer.RENDER), 1, maxColorAttachment);
BufferUtils.destroyDirectBuffer(maxColorAttachment);
// Step 3, render the colorbuffer from the multisampled framebuffer
renderFB(gl4);
return true;
}
示例12: initBuffer
import com.jogamp.opengl.util.GLBuffers; //导入方法依赖的package包/类
private boolean initBuffer(GL4 gl4) {
ByteBuffer vertexBuffer = GLBuffers.newDirectByteBuffer(vertexSize);
IntBuffer uniformBufferOffset = GLBuffers.newDirectIntBuffer(1);
gl4.glGenBuffers(Buffer.MAX, bufferName);
gl4.glBindBuffer(GL_ARRAY_BUFFER, bufferName.get(Buffer.VERTEX));
for (int i = 0; i < vertexCount; i++) {
vertexData[i].toDbb(vertexBuffer, i * Vec2.SIZE);
}
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;
}
示例13: initBuffer
import com.jogamp.opengl.util.GLBuffers; //导入方法依赖的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);
IntBuffer uniformBufferOffset = GLBuffers.newDirectIntBuffer(1);
gl4.glGetIntegerv(GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT, uniformBufferOffset);
int uniformBlockSize = Math.max(Mat4.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(elementBuffer);
BufferUtils.destroyDirectBuffer(vertexBuffer);
BufferUtils.destroyDirectBuffer(uniformBufferOffset);
return validated;
}
开发者ID:java-opengl-labs,项目名称:jogl-samples,代码行数:32,代码来源:Gl_430_program_compute_variable_group_size.java
示例14: initMax
import com.jogamp.opengl.util.GLBuffers; //导入方法依赖的package包/类
private boolean initMax(GL4 gl4) {
final int maxVertexAttribs = 0, maxVertexOutput = 1, maxControlInput = 2, maxControlOutput = 3,
maxControlTotalOutput = 4, maxEvaluationInput = 5, maxEvaluationOutput = 6, maxGeometryInput = 7,
maxGeometryOutput = 8, maxFragmentInput = 9, max = 10;
IntBuffer data = GLBuffers.newDirectIntBuffer(max);
data.position(maxVertexAttribs);
gl4.glGetIntegerv(GL_MAX_VERTEX_ATTRIBS, data);
//GL_MAX_DRAW_BUFFERS 8
//GL_MAX_COLOR_ATTACHMENTS 8
data.position(maxVertexOutput);
gl4.glGetIntegerv(GL_MAX_VERTEX_OUTPUT_COMPONENTS, data);
data.position(maxControlInput);
gl4.glGetIntegerv(GL_MAX_TESS_CONTROL_INPUT_COMPONENTS, data);
data.position(maxControlOutput);
gl4.glGetIntegerv(GL_MAX_TESS_CONTROL_OUTPUT_COMPONENTS, data);
data.position(maxControlTotalOutput);
gl4.glGetIntegerv(GL_MAX_TESS_CONTROL_TOTAL_OUTPUT_COMPONENTS, data);
data.position(maxEvaluationInput);
gl4.glGetIntegerv(GL_MAX_TESS_EVALUATION_INPUT_COMPONENTS, data);
data.position(maxEvaluationOutput);
gl4.glGetIntegerv(GL_MAX_TESS_EVALUATION_OUTPUT_COMPONENTS, data);
data.position(maxGeometryInput);
gl4.glGetIntegerv(GL_MAX_GEOMETRY_INPUT_COMPONENTS, data);
data.position(maxGeometryOutput);
gl4.glGetIntegerv(GL_MAX_GEOMETRY_OUTPUT_COMPONENTS, data);
data.position(maxFragmentInput);
gl4.glGetIntegerv(GL_MAX_FRAGMENT_INPUT_COMPONENTS, data);
return true;
}
示例15: initBuffer
import com.jogamp.opengl.util.GLBuffers; //导入方法依赖的package包/类
private boolean initBuffer(GL4 gl4) {
IntBuffer elementBuffer = GLBuffers.newDirectIntBuffer(elementData);
FloatBuffer vertexBuffer = GLBuffers.newDirectFloatBuffer(vertexData);
IntBuffer uniformBufferOffset = GLBuffers.newDirectIntBuffer(1);
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.glGetIntegerv(GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT, uniformBufferOffset);
int uniformBlockSize = Math.max(Mat4.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(elementBuffer);
BufferUtils.destroyDirectBuffer(vertexBuffer);
BufferUtils.destroyDirectBuffer(uniformBufferOffset);
return checkError(gl4, "initBuffer");
}