本文整理汇总了Java中gov.nasa.worldwind.cache.GpuResourceCache类的典型用法代码示例。如果您正苦于以下问题:Java GpuResourceCache类的具体用法?Java GpuResourceCache怎么用?Java GpuResourceCache使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GpuResourceCache类属于gov.nasa.worldwind.cache包,在下文中一共展示了GpuResourceCache类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: fillVerticesVBO
import gov.nasa.worldwind.cache.GpuResourceCache; //导入依赖的package包/类
protected void fillVerticesVBO(DrawContext dc)
{
GL gl = dc.getGL();
int[] vboIds = (int[]) dc.getGpuResourceCache().get(this.vboCacheKey);
if (vboIds == null)
{
vboIds = new int[1];
gl.glGenBuffers(vboIds.length, vboIds, 0);
int size = this.vertices.limit() * 4;
dc.getGpuResourceCache().put(this.vboCacheKey, vboIds, GpuResourceCache.VBO_BUFFERS, size);
}
try
{
FloatBuffer vb = this.vertices;
gl.glBindBuffer(GL.GL_ARRAY_BUFFER, vboIds[0]);
gl.glBufferData(GL.GL_ARRAY_BUFFER, vb.limit() * 4, vb.rewind(), GL.GL_STATIC_DRAW);
}
finally
{
gl.glBindBuffer(GL.GL_ARRAY_BUFFER, 0);
}
}
示例2: fillIndexListVbo
import gov.nasa.worldwind.cache.GpuResourceCache; //导入依赖的package包/类
protected int[] fillIndexListVbo(DrawContext dc, int density, IntBuffer indices)
{
GL gl = dc.getGL();
Object indexListVboCacheKey = indexListsVboCacheKeys.get(density);
int[] indexListVboId = (int[])
(indexListVboCacheKey != null ? dc.getGpuResourceCache().get(indexListVboCacheKey) : null);
if (indexListVboId == null)
{
indexListVboId = new int[1];
gl.glGenBuffers(indexListVboId.length, indexListVboId, 0);
if (indexListVboCacheKey == null)
{
indexListVboCacheKey = new Object();
indexListsVboCacheKeys.put(density, indexListVboCacheKey);
}
int size = indices.limit() * 4;
dc.getGpuResourceCache().put(indexListVboCacheKey, indexListVboId, GpuResourceCache.VBO_BUFFERS, size);
}
try
{
gl.glBindBuffer(GL.GL_ELEMENT_ARRAY_BUFFER, indexListVboId[0]);
gl.glBufferData(GL.GL_ELEMENT_ARRAY_BUFFER, indices.limit() * 4, indices.rewind(), GL.GL_STATIC_DRAW);
}
finally
{
gl.glBindBuffer(GL.GL_ELEMENT_ARRAY_BUFFER, 0);
}
return indexListVboId;
}
示例3: fillTextureCoordsVbo
import gov.nasa.worldwind.cache.GpuResourceCache; //导入依赖的package包/类
protected int[] fillTextureCoordsVbo(DrawContext dc, int density, FloatBuffer texCoords)
{
GL gl = dc.getGL();
Object texCoordVboCacheKey = textureCoordVboCacheKeys.get(density);
int[] texCoordVboId = (int[])
(texCoordVboCacheKey != null ? dc.getGpuResourceCache().get(texCoordVboCacheKey) : null);
if (texCoordVboId == null)
{
texCoordVboId = new int[1];
gl.glGenBuffers(texCoordVboId.length, texCoordVboId, 0);
if (texCoordVboCacheKey == null)
{
texCoordVboCacheKey = new Object();
textureCoordVboCacheKeys.put(density, texCoordVboCacheKey);
}
int size = texCoords.limit() * 4;
dc.getGpuResourceCache().put(texCoordVboCacheKey, texCoordVboId, GpuResourceCache.VBO_BUFFERS, size);
}
try
{
gl.glBindBuffer(GL.GL_ARRAY_BUFFER, texCoordVboId[0]);
gl.glBufferData(GL.GL_ARRAY_BUFFER, texCoords.limit() * 4, texCoords.rewind(), GL.GL_STATIC_DRAW);
}
finally
{
gl.glBindBuffer(GL.GL_ARRAY_BUFFER, 0);
}
return texCoordVboId;
}