本文整理汇总了Java中com.jogamp.common.nio.Buffers.newDirectDoubleBuffer方法的典型用法代码示例。如果您正苦于以下问题:Java Buffers.newDirectDoubleBuffer方法的具体用法?Java Buffers.newDirectDoubleBuffer怎么用?Java Buffers.newDirectDoubleBuffer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.jogamp.common.nio.Buffers
的用法示例。
在下文中一共展示了Buffers.newDirectDoubleBuffer方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
}
示例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);
}
}
示例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);
}
}
示例4: initializeCrossline
import com.jogamp.common.nio.Buffers; //导入方法依赖的package包/类
private void initializeCrossline(DrawContext dc) {
DoubleBuffer verts = crossLine;
if (verts == null)
verts = Buffers.newDirectDoubleBuffer(points.size() * 3);
for (LatLon point : points)
{
double alt =
elevation + baseHeight * exageration * (yMax - yMin) * crossLinePercent;
Vec4 p1 =
dc.getGlobe().computePointFromPosition(point.getLatitude(), point.getLongitude(), alt);
verts.put(p1.x - referenceCenter.x);
verts.put(p1.y - referenceCenter.y);
verts.put(p1.z - referenceCenter.z);
}
this.crossLine = verts;
}
示例5: createVBO
import com.jogamp.common.nio.Buffers; //导入方法依赖的package包/类
public static VBO createVBO(GL2 gl, List<Vector3d> vertices, double[] color) {
DoubleBuffer b = DoubleBuffer.allocate(VERTEX_SIZE * vertices.size() * 2);
for(Vector3d vertex : vertices) {
b.put(vertex.asArray());
b.put(color);
}
DoubleBuffer vertex_data = Buffers.newDirectDoubleBuffer(b.array());
vertex_data.flip();
int[] handles = new int[1];
gl.glGenBuffers(1, handles, 0);
int vbo_vertex_handle = handles[0];
gl.glBindBuffer(GL.GL_ARRAY_BUFFER, vbo_vertex_handle);
gl.glBufferData(GL.GL_ARRAY_BUFFER, Buffers.SIZEOF_DOUBLE * vertex_data.capacity(), vertex_data, GL.GL_STATIC_DRAW);
gl.glBindBuffer(GL.GL_ARRAY_BUFFER, 0);
return new VBO(handles, vertices.size());
}
示例6: initializeStilts
import com.jogamp.common.nio.Buffers; //导入方法依赖的package包/类
private void initializeStilts(DrawContext dc) {
DoubleBuffer verts = stilts;
if (verts == null)
verts = Buffers.newDirectDoubleBuffer(points.size() * 2 * 3);
for (LatLon point : points)
{
Vec4 p1 =
dc.getGlobe().computePointFromPosition(point.getLatitude(), point.getLongitude(), elevation);
Vec4 p2 = dc.getSurfaceGeometry().getSurfacePoint(
new Position(point, 0));
if (p2 == null)
{
double elev =
dc.getGlobe().getElevation(
point.latitude, point.longitude)
* dc.getVerticalExaggeration();
p2 = dc.getGlobe().computePointFromPosition(
new Position(point, elev));
}
verts.put(p1.x - referenceCenter.x);
verts.put(p1.y - referenceCenter.y);
verts.put(p1.z - referenceCenter.z);
verts.put(p2.x - referenceCenter.x);
verts.put(p2.y - referenceCenter.y);
verts.put(p2.z - referenceCenter.z);
}
this.stilts = verts;
}
示例7: initializeGeometry
import com.jogamp.common.nio.Buffers; //导入方法依赖的package包/类
private void initializeGeometry(DrawContext dc)
{
DoubleBuffer verts = Buffers.newDirectDoubleBuffer(points.size() * 2 * 3);
Vec4[][] p = new Vec4[points.size()][2];
int i = 0;
for (LatLon point : points)
{
p[i][0] = dc.getGlobe().computePointFromPosition(point.getLatitude(), point.getLongitude(), elevation);
p[i][1] = dc.getGlobe().computePointFromPosition(point.getLatitude(), point.getLongitude(), elevation + baseHeight * exageration * (yMax - yMin));
i++;
}
Vec4 refcenter = p[p.length / 2][0];
for (i = 0; i < p.length; i++)
{
verts.put(p[i][0].x - refcenter.x);
verts.put(p[i][0].y - refcenter.y);
verts.put(p[i][0].z - refcenter.z);
verts.put(p[i][1].x - refcenter.x);
verts.put(p[i][1].y - refcenter.y);
verts.put(p[i][1].z - refcenter.z);
}
this.referenceCenter = refcenter;
this.vertices = verts;
}
示例8: setFloatBuffert
import com.jogamp.common.nio.Buffers; //导入方法依赖的package包/类
/**
*
* @param floats
*/
public final void setFloatBuffert(final double[] floats) {
final DoubleBuffer buffer;
buffer = Buffers.newDirectDoubleBuffer(floats.length);
buffer.put(floats);
buffer.rewind();
setBuffer(buffer);
}
示例9: setup
import com.jogamp.common.nio.Buffers; //导入方法依赖的package包/类
@Override
protected void setup(GLAutoDrawable drawable) {
GL2 gl = drawable.getGL().getGL2();
glu = new GLU();
boolean extensionOK = gl.isExtensionAvailable
("GL_ARB_vertex_buffer_object");
logger.info( "VBO extension:{} ",extensionOK );
boolean functionsOK =
gl.isFunctionAvailable("glGenBuffersARB") &&
gl.isFunctionAvailable("glBindBufferARB") &&
gl.isFunctionAvailable("glBufferDataARB") &&
gl.isFunctionAvailable("glDeleteBuffersARB");
logger.info( "Functions: {}", functionsOK);
vertices = 3;
vertex_size = 3;
DoubleBuffer b = DoubleBuffer.allocate(vertex_size * vertices * 2);
b.put(new double[] { -1f, -1f, 0f, });
b.put(new double[] { 1f, 0f, 0f, }); // color
b.put(new double[] { 1f, -1f, 0f, });
b.put(new double[] { 0f, 1f, 0f, }); // color
b.put(new double[] { 0f, 1f, 0f, });
b.put(new double[] { 0f, 0f, 1f, }); // color
DoubleBuffer vertex_data = Buffers.newDirectDoubleBuffer(b.array());
vertex_data.flip();
handles = new int[1];
gl.glGenBuffers(1, handles, 0);
vbo_vertex_handle = handles[0];
gl.glBindBuffer(GL.GL_ARRAY_BUFFER, vbo_vertex_handle);
gl.glBufferData(GL.GL_ARRAY_BUFFER, Buffers.SIZEOF_DOUBLE * vertex_data.capacity(), vertex_data, GL.GL_STATIC_DRAW);
gl.glBindBuffer(GL.GL_ARRAY_BUFFER, 0);
renderer.init(gl);
}