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


Java GpuResourceCache类代码示例

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

示例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;
}
 
开发者ID:iedadata,项目名称:geomapapp,代码行数:35,代码来源:MYEBSRectangularTessellator.java

示例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;
}
 
开发者ID:iedadata,项目名称:geomapapp,代码行数:35,代码来源:MYEBSRectangularTessellator.java


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