当前位置: 首页>>代码示例>>Java>>正文


Java PGL.genBuffers方法代码示例

本文整理汇总了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);
        
    }
 
开发者ID:poqudrof,项目名称:PapARt,代码行数:39,代码来源:PointCloud.java

示例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();
	}
 
开发者ID:ThomasLengeling,项目名称:KinectPV2,代码行数:25,代码来源:PointCloudColorTest.java

示例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();
}
 
开发者ID:cacheflowe,项目名称:haxademic,代码行数:25,代码来源:Kinect2ParticleDepth.java


注:本文中的processing.opengl.PGL.genBuffers方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。