當前位置: 首頁>>代碼示例>>Java>>正文


Java GL.glBindBuffer方法代碼示例

本文整理匯總了Java中javax.media.opengl.GL.glBindBuffer方法的典型用法代碼示例。如果您正苦於以下問題:Java GL.glBindBuffer方法的具體用法?Java GL.glBindBuffer怎麽用?Java GL.glBindBuffer使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.media.opengl.GL的用法示例。


在下文中一共展示了GL.glBindBuffer方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: fillVerticesVBO

import javax.media.opengl.GL; //導入方法依賴的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 javax.media.opengl.GL; //導入方法依賴的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 javax.media.opengl.GL; //導入方法依賴的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


注:本文中的javax.media.opengl.GL.glBindBuffer方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。