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


Java Buffers.newDirectFloatBuffer方法代码示例

本文整理汇总了Java中com.jogamp.common.nio.Buffers.newDirectFloatBuffer方法的典型用法代码示例。如果您正苦于以下问题:Java Buffers.newDirectFloatBuffer方法的具体用法?Java Buffers.newDirectFloatBuffer怎么用?Java Buffers.newDirectFloatBuffer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.jogamp.common.nio.Buffers的用法示例。


在下文中一共展示了Buffers.newDirectFloatBuffer方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: init

import com.jogamp.common.nio.Buffers; //导入方法依赖的package包/类
@Override
public void init() {
	if(init && GLOptions.USE_VBOS){
		vertexBuffer = Buffers.newDirectDoubleBuffer(1024*8*size/4 * 3);
		texCoordBuffer = Buffers.newDirectFloatBuffer(1024*8*size/4 * 2);
		colorBuffer = Buffers.newDirectFloatBuffer(1024*8*size/4 * 4);
		normalBuffer = Buffers.newDirectFloatBuffer(1024*8*size/4 * 3);
		init= false;
	}else{
		if(GLOptions.USE_VBOS){
			clear();
		}
	}
	this.hasColor = false;
	this.hasTexture = false;
	this.hasNormals = false;
	vertices = 0;
	a=1;
	if(!GLOptions.USE_VBOS){
		gl.glBegin(mType);
	}
}
 
开发者ID:ZetzmannM,项目名称:CGL,代码行数:23,代码来源:DoubleAdvancedTesselatorBase.java

示例2: init

import com.jogamp.common.nio.Buffers; //导入方法依赖的package包/类
@Override
public void init() {
	if(init && GLOptions.USE_VBOS){
		vertexBuffer = Buffers.newDirectDoubleBuffer(1024*size/ 3);
		texCoordBuffer = Buffers.newDirectFloatBuffer(1024*size/ 2);
		colorBuffer = Buffers.newDirectFloatBuffer(1024*size/ 4);
		init= false;
	}else{
		if(GLOptions.USE_VBOS){
			clear();
		}
	}
	this.hasColor = false;
	this.hasTexture = false;
	vertices = 0;
	a=1;
	if(!GLOptions.USE_VBOS){
		gl.glBegin(mType);
	}
}
 
开发者ID:ZetzmannM,项目名称:CGL,代码行数:21,代码来源:DoubleTesselatorBase.java

示例3: init

import com.jogamp.common.nio.Buffers; //导入方法依赖的package包/类
@Override
public void init() {
	if(init && useVBOs){
		vertexBuffer = Buffers.newDirectDoubleBuffer(1024*8*size/4 * 2);
		texCoordBuffer = Buffers.newDirectFloatBuffer(1024*8*size/4 * 2);
		colorBuffer = Buffers.newDirectFloatBuffer(1024*8*size);
		init= false;
	}else{
		if(useVBOs){
			clear();
		}
	}
	this.hasColor = false;
	this.hasTexture = false;
	vertices = 0;
	a=1;
	if(!useVBOs){
		gl.glBegin(mType);
	}
}
 
开发者ID:ZetzmannM,项目名称:CGL,代码行数:21,代码来源:DoubleTesselatorBase2D.java

示例4: init

import com.jogamp.common.nio.Buffers; //导入方法依赖的package包/类
@Override
public void init() {
	if(GLOptions.USE_VBOS){
		vertexBuffer = Buffers.newDirectFloatBuffer(1024*size/ 4);
		texCoordBuffer = Buffers.newDirectFloatBuffer(1024*size/ 2);
		colorBuffer = Buffers.newDirectFloatBuffer(1024*size/ 4);
	}else{
		if(GLOptions.USE_VBOS){
			clear();
		}
	}
	this.hasColor = false;
	this.hasTexture = false;
	vertices = 0;
	a=1;
	if(!GLOptions.USE_VBOS){
		gl.glBegin(mType);
	}
}
 
开发者ID:ZetzmannM,项目名称:CGL,代码行数:20,代码来源:TesselatorBase4D.java

示例5: transform

import com.jogamp.common.nio.Buffers; //导入方法依赖的package包/类
private void transform() {
	float[] val = new float[vertexBuffer.limit()];
	vertexBuffer.get(val, 0, val.length);
	float[] out = new float[val.length/4*3];
	int ind = 0;

	while(ind < val.length/4){
		float[] o = transformV(val[ind*4], val[ind*4+1], val[ind*4+2], val[ind*4+3]);
		for(int i = 0; i < o.length; i++){
			out[ind*3+i] = o[i];
		}
		ind++;
	}

	this.vertexBuffer =  Buffers.newDirectFloatBuffer(out);
}
 
开发者ID:ZetzmannM,项目名称:CGL,代码行数:17,代码来源:TesselatorBase4D.java

示例6: init

import com.jogamp.common.nio.Buffers; //导入方法依赖的package包/类
@Override
public void init() {
	if(init && GLOptions.USE_VBOS){
		vertexBuffer = Buffers.newDirectFloatBuffer(1024*size/ 3);
		texCoordBuffer = Buffers.newDirectFloatBuffer(1024*size/ 2);
		colorBuffer = Buffers.newDirectFloatBuffer(1024*size/ 4);
		init= false;
	}else{
		if(GLOptions.USE_VBOS){
			clear();
		}
	}
	this.hasColor = false;
	this.hasTexture = false;
	vertices = 0;
	a=1;
	if(!GLOptions.USE_VBOS){
		gl.glBegin(mType);
	}
}
 
开发者ID:ZetzmannM,项目名称:CGL,代码行数:21,代码来源:TesselatorBase.java

示例7: init

import com.jogamp.common.nio.Buffers; //导入方法依赖的package包/类
@Override
public void init() {
	if(init && useVBOs){
		vertexBuffer = Buffers.newDirectFloatBuffer(1024*8*size/4 * 2);
		texCoordBuffer = Buffers.newDirectFloatBuffer(1024*8*size/4 * 2);
		colorBuffer = Buffers.newDirectFloatBuffer(1024*8*size);
		init= false;
	}else{
		if(useVBOs){
			clear();
		}
	}
	this.hasColor = false;
	this.hasTexture = false;
	vertices = 0;
	a=1;
	if(!useVBOs){
		gl.glBegin(mType);
	}
}
 
开发者ID:ZetzmannM,项目名称:CGL,代码行数:21,代码来源:TesselatorBase2D.java

示例8: init

import com.jogamp.common.nio.Buffers; //导入方法依赖的package包/类
@Override
public void init() {
	if(init && GLOptions.USE_VBOS){
		vertexBuffer = Buffers.newDirectFloatBuffer(1024*8*size/4 * 3);
		texCoordBuffer = Buffers.newDirectFloatBuffer(1024*8*size/4 * 2);
		colorBuffer = Buffers.newDirectFloatBuffer(1024*8*size/4 * 4);
		normalBuffer = Buffers.newDirectFloatBuffer(1024*8*size/4 * 3);
		init= false;
	}else{
		if(GLOptions.USE_VBOS){
			clear();
		}
	}
	this.hasColor = false;
	this.hasTexture = false;
	this.hasNormals = false;
	vertices = 0;
	a=1;
	if(!GLOptions.USE_VBOS){
		gl.glBegin(mType);
	}
}
 
开发者ID:ZetzmannM,项目名称:CGL,代码行数:23,代码来源:AttributeTesselatorBase.java

示例9: getDataBuffer

import com.jogamp.common.nio.Buffers; //导入方法依赖的package包/类
/**
 * Get a buffer with all vertices of the SurfaceCompilation.
 *
 * @return A buffer with all vertices of the SurfaceCompilation.
 */
public FloatBuffer getDataBuffer() {
    final List<Float> dataList = new ArrayList<>();
    //Iterate over all vertices in the SurfaceCompilation.
    for (IndexedVertex vertex : vertices) {
        //And store all vertices' data in an ArrayList.
        dataList.add(vertex.getVertex().getPositionA()[IND_X]);
        dataList.add(vertex.getVertex().getPositionA()[IND_Y]);
        dataList.add(vertex.getVertex().getPositionA()[IND_Z]);
        dataList.add(vertex.getVertex().getNormalA()[IND_X]);
        dataList.add(vertex.getVertex().getNormalA()[IND_Y]);
        dataList.add(vertex.getVertex().getNormalA()[IND_Z]);
        dataList.add(vertex.getVertex().getTextureA()[IND_X]);
        dataList.add(vertex.getVertex().getTextureA()[IND_Y]);
        dataList.add(vertex.getVertex().getTextureA()[IND_Z]);
    }
    final float[] dataArray = new float[dataList.size()];
    //Convert the ArrayList into an array.
    for (int i = 0; i < dataArray.length; i++) {
        dataArray[i] = dataList.get(i);
    }
    //Deliver it in the form of a buffer.
    return Buffers.newDirectFloatBuffer(dataArray);
}
 
开发者ID:ABoschman,项目名称:2IV60_RobotRace,代码行数:29,代码来源:SurfaceCompilation.java

示例10: PipelinedQuadRenderer

import com.jogamp.common.nio.Buffers; //导入方法依赖的package包/类
public PipelinedQuadRenderer() {
	final GL2 gl = GLContext.getCurrentGL().getGL2();
	mVertCoords = Buffers.newDirectFloatBuffer(kTotalBufferSizeCoordsVerts);
	mTexCoords = Buffers.newDirectFloatBuffer(kTotalBufferSizeCoordsTex);

	try {
		final int[] vbos = new int[2];
		gl.glGenBuffers(2, IntBuffer.wrap(vbos));

		mVBO_For_ResuableTileVertices = vbos[0];
		mVBO_For_ResuableTileTexCoords = vbos[1];

		gl.glBindBuffer(GL.GL_ARRAY_BUFFER,
				mVBO_For_ResuableTileVertices);
		gl.glBufferData(GL.GL_ARRAY_BUFFER, kTotalBufferSizeBytesVerts,
				null, GL2ES2.GL_STREAM_DRAW); // stream draw because this is a single quad use pipeline

		gl.glBindBuffer(GL.GL_ARRAY_BUFFER,
				mVBO_For_ResuableTileTexCoords);
		gl.glBufferData(GL.GL_ARRAY_BUFFER, kTotalBufferSizeBytesTex,
				null, GL2ES2.GL_STREAM_DRAW); // stream draw because this is a single quad use pipeline
	} catch (final Exception e) {
		usingVBOs = false;
	}
}
 
开发者ID:jedwards1211,项目名称:breakout,代码行数:26,代码来源:PipelinedQuadRenderer.java

示例11: AbstractQuadPipeline

import com.jogamp.common.nio.Buffers; //导入方法依赖的package包/类
/**
 * Constructs an abstract quad pipeline.
 *
 * @param vertsPerPrim Number of vertices per primitive
 * @param primsPerQuad Number of primitives per quad
 * @throws IllegalArgumentException if vertices or primitives is less than one
 */
AbstractQuadPipeline(/*@Nonnegative*/ final int vertsPerPrim,
                     /*@Nonnegative*/ final int primsPerQuad) {

    Check.argument(vertsPerPrim > 0, "Number of vertices is less than one");
    Check.argument(primsPerQuad > 0, "Number of primitives is less than one");

    VERTS_PER_PRIM = vertsPerPrim;
    PRIMS_PER_QUAD = primsPerQuad;
    PRIMS_PER_BUFFER = primsPerQuad * QUADS_PER_BUFFER;
    VERTS_PER_QUAD = vertsPerPrim * primsPerQuad;
    VERTS_PER_BUFFER = PRIMS_PER_BUFFER * VERTS_PER_PRIM;
    FLOATS_PER_BUFFER = FLOATS_PER_VERT * VERTS_PER_BUFFER;
    BYTES_PER_BUFFER = BYTES_PER_VERT * VERTS_PER_BUFFER;
    BYTES_PER_QUAD = BYTES_PER_VERT * VERTS_PER_QUAD;

    this.data = Buffers.newDirectFloatBuffer(FLOATS_PER_BUFFER);
}
 
开发者ID:jedwards1211,项目名称:breakout,代码行数:25,代码来源:AbstractQuadPipeline.java

示例12: getPositionBuffer

import com.jogamp.common.nio.Buffers; //导入方法依赖的package包/类
private static FloatBuffer getPositionBuffer(ActorModel model) {
	List<Vector3f> vertices = model.getVertices();
	List<Face> faces = model.getFaces();

	FloatBuffer vertexData = Buffers
			.newDirectFloatBuffer(faces.size() * 3 * 3);

	for (Face face : faces) {
		int[] indices = face.getVertexIndices();
		for (int i = 0; i < indices.length; i++) {
			vertexData.put(vertices.get(indices[i] - 1).x);
			vertexData.put(vertices.get(indices[i] - 1).y);
			vertexData.put(vertices.get(indices[i] - 1).z);
		}
	}
	return (FloatBuffer) vertexData.rewind();
}
 
开发者ID:galaxy-workstation,项目名称:AircraftDemo,代码行数:18,代码来源:Builder.java

示例13: getTexCoordBuffer

import com.jogamp.common.nio.Buffers; //导入方法依赖的package包/类
private static FloatBuffer getTexCoordBuffer(ActorModel model) {
	List<Face> faces = model.getFaces();
	List<Vector2f> textureCoordinates = model.getTextureCoordinates();

	FloatBuffer texCoordData = Buffers
			.newDirectFloatBuffer(faces.size() * 3 * 2);

	for (Face face : faces) {
		int[] indices = face.getTextureCoordinateIndices();
		float[] coord = new float[indices.length * 2];
		for (int i = 0; i < indices.length; i++) {
			coord[2 * i] = textureCoordinates.get(indices[i] - 1).x;
			coord[2 * i + 1] = textureCoordinates.get(indices[i] - 1).y;
		}
		texCoordData.put(coord);
	}
	return (FloatBuffer) texCoordData.rewind();
}
 
开发者ID:galaxy-workstation,项目名称:AircraftDemo,代码行数:19,代码来源:Builder.java

示例14: Series

import com.jogamp.common.nio.Buffers; //导入方法依赖的package包/类
/**
 * Create a new Series object with <code>capacity</code>.
 * @param dimensions the number of dimensions (2 or 3)
 * @param capacity max number of points
 */
public Series(int dimensions, int capacity) {
	dimension = dimensions;
	this.capacity = capacity;
	elementSize = Float.SIZE / 8;
	cache = Buffers.newDirectFloatBuffer(dimension * capacity);
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:12,代码来源:Series.java

示例15: startDrawCycle

import com.jogamp.common.nio.Buffers; //导入方法依赖的package包/类
public void startDrawCycle(boolean first) {
	if (fbVertices == null) {
		fbVertices = Buffers.newDirectFloatBuffer(3 * ELEMENT_VERTICES_COUNT * ELEMENTS_MAX_COUNT_PER_BUFFER);
		txVertices = Buffers.newDirectFloatBuffer(2 * ELEMENT_VERTICES_COUNT * ELEMENTS_MAX_COUNT_PER_BUFFER);
		colVertices = Buffers.newDirectFloatBuffer(4 * ELEMENT_VERTICES_COUNT * ELEMENTS_MAX_COUNT_PER_BUFFER);
	}
	if (first || fbVertices == null || cycleEnded) {
		fbElements = 0;
	}
	cycleEnded = false;
}
 
开发者ID:XDrake99,项目名称:WarpPI,代码行数:12,代码来源:GPURenderer.java


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