本文整理汇总了Java中processing.opengl.PGL.genBuffers方法的典型用法代码示例。如果您正苦于以下问题:Java PGL.genBuffers方法的具体用法?Java PGL.genBuffers怎么用?Java PGL.genBuffers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类processing.opengl.PGL
的用法示例。
在下文中一共展示了PGL.genBuffers方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initPointCloud
import processing.opengl.PGL; //导入方法依赖的package包/类
private void initPointCloud() {
PGL pgl = ((PGraphicsOpenGL) parentApplet.g).pgl;
// TODO: lookt at the shaders...
myShader = parentApplet.loadShader(PointCloud.class.getResource("points.frag").toString(),
PointCloud.class.getResource("points.vert").toString());
myShader.bind();
shaderProgram = myShader.glProgram;
vertLoc = pgl.getAttribLocation(shaderProgram, "vertex");
colorsLoc = pgl.getAttribLocation(shaderProgram, "color");
transformLoc = pgl.getUniformLocation(shaderProgram, "transform");
myShader.unbind();
// System.out.println("Shader program " + shaderProgram + " vertex loc " + vertLoc + " transform loc " + transformLoc + " colors " + colorsLoc);
// Allocate the buffer in central memory (native), then java, then OpenGL
// Native memory
int byteSize = nbPoints * 4 * 4; // 4 : SizeOf Float -> ? SIZEOF_FLOAT
verticesNative = ByteBuffer.allocateDirect(byteSize).order(ByteOrder.nativeOrder()).
asFloatBuffer();
colorsNative = ByteBuffer.allocateDirect(byteSize).order(ByteOrder.nativeOrder()).asIntBuffer();
// Java memory
verticesJava = new float[nbPoints * 4];
colorsJava = new int[nbPoints];
// System.out.println("Buffer vertex object: " + glVertBuff);
// unbind the buffer.
pgl.bindBuffer(PGL.ARRAY_BUFFER, 0);
// Generate a buffer color data and color.
IntBuffer intBuffer = IntBuffer.allocate(2);
pgl.genBuffers(2, intBuffer);
vertexBuffer = intBuffer.get(0);
colorBuffer = intBuffer.get(1);
}
示例2: setup
import processing.opengl.PGL; //导入方法依赖的package包/类
public void setup() {
kinect = new KinectPV2(this);
kinect.enableDepthImg(true);
kinect.enableColorImg(true);
kinect.enableColorPointCloud(true);
kinect.init();
sh = loadShader("frag.glsl", "vert.glsl");
PGL pgl = beginPGL();
// allocate buffer big enough to get all VBO ids back
IntBuffer intBuffer = IntBuffer.allocate(2);
pgl.genBuffers(2, intBuffer);
//memory location of the VBO
vertexVboId = intBuffer.get(0);
colorVboId = intBuffer.get(1);
endPGL();
}
示例3: setupFirstFrame
import processing.opengl.PGL; //导入方法依赖的package包/类
public void setupFirstFrame() {
kinect = new KinectPV2(this);
kinect.enableDepthImg(true);
kinect.enablePointCloud(true);
kinect.setLowThresholdPC(minD);
kinect.setHighThresholdPC(maxD);
kinect.init();
sh = loadShader(FileUtil.getFile("shaders/vertex/kinect-points-frag.glsl"), FileUtil.getFile("shaders/vertex/kinect-points-vert.glsl"));
PGL pgl = beginPGL();
IntBuffer intBuffer = IntBuffer.allocate(1);
pgl.genBuffers(1, intBuffer);
//memory location of the VBO
vertexVboId = intBuffer.get(0);
endPGL();
}