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


Java GL2.glTexCoordPointer方法代碼示例

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


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

示例1: renderVA

import javax.media.opengl.GL2; //導入方法依賴的package包/類
protected void renderVA(DrawContext dc, RectTile tile, int numTextureUnits)
{
    //GL gl = dc.getGL();
	GL2 gl = dc.getGL().getGL2(); // GL initialization checks for GL2 compatibility.

    gl.glVertexPointer(3, GL.GL_FLOAT, 0, tile.ri.vertices.rewind());

    for (int i = 0; i < numTextureUnits; i++)
    {
        gl.glClientActiveTexture(GL.GL_TEXTURE0 + i);
        gl.glEnableClientState(GL2.GL_TEXTURE_COORD_ARRAY);
        Object texCoords = dc.getValue(AVKey.TEXTURE_COORDINATES);
        if (texCoords != null && texCoords instanceof DoubleBuffer)
            gl.glTexCoordPointer(2, GL2.GL_FLOAT, 0, ((DoubleBuffer) texCoords).rewind());
        else
            gl.glTexCoordPointer(2, GL2.GL_FLOAT, 0, tile.ri.texCoords.rewind());
    }

    gl.glDrawElements(javax.media.opengl.GL.GL_TRIANGLE_STRIP, tile.ri.indices.limit(),
        javax.media.opengl.GL.GL_UNSIGNED_INT, tile.ri.indices.rewind());
}
 
開發者ID:iedadata,項目名稱:geomapapp,代碼行數:22,代碼來源:MYEBSRectangularTessellator.java

示例2: startDraw

import javax.media.opengl.GL2; //導入方法依賴的package包/類
/**
 * Must be called at the start of the draw phase, before any of the bodies
 * managed by this instance are drawn.
 *
 * @param gl The instance of GL2 responsible for drawing the bodies.
 * @see #endDraw Must be called in conjunction with this method.
 */
public void startDraw(GL2 gl) {
    gl.glEnableClientState(GL2.GL_VERTEX_ARRAY);
    gl.glEnableClientState(GL2.GL_NORMAL_ARRAY);
    gl.glEnableClientState(GL2.GL_TEXTURE_COORD_ARRAY);
    //Use the name under which the data buffer was stored to bind it.
    gl.glBindBuffer(GL2.GL_ARRAY_BUFFER, dataBufferName);
    final int stride = Vertex.NR_VERTEX_ELEMENTS * Vertex.COORD_COUNT * Float.BYTES;
    /**
     * Tell OpenGL what formats and what stride length to expect when
     * extracting vertex coordinate information from the data buffer.
     */
    final int positionPointerOffset = 0 * Vertex.COORD_COUNT * Float.BYTES;
    gl.glVertexPointer(Vertex.COORD_COUNT, GL2.GL_FLOAT, stride, positionPointerOffset);
    /**
     * Tell OpenGL what formats, stride length and offset to expect when
     * extracting normal information from the data buffer.
     */
    final int normalPointerOffset = 1 * Vertex.COORD_COUNT * Float.BYTES;
    gl.glNormalPointer(GL2.GL_FLOAT, stride, normalPointerOffset);
    /**
     * Tell OpenGL what formats, stride length and offset to expect when
     * extracting texture information from the data buffer.
     */
    final int texturePointerOffset = 2 * Vertex.COORD_COUNT * Float.BYTES;
    gl.glTexCoordPointer(Vertex.COORD_COUNT, GL2.GL_FLOAT, stride, texturePointerOffset);
}
 
開發者ID:ABoschman,項目名稱:2IV60_RobotRace,代碼行數:34,代碼來源:BufferManager.java

示例3: bindVbos

import javax.media.opengl.GL2; //導入方法依賴的package包/類
protected boolean bindVbos(DrawContext dc, RectTile tile, int numTextureUnits)
{
    int[] verticesVboId = (int[]) dc.getGpuResourceCache().get(tile.ri.vboCacheKey);
    if (verticesVboId == null)
    {
        tile.ri.fillVerticesVBO(dc);
        verticesVboId = (int[]) dc.getGpuResourceCache().get(tile.ri.vboCacheKey);
        if (verticesVboId == null)
            return false;
    }

    //GL gl = dc.getGL();
    GL2 gl = dc.getGL().getGL2(); // GL initialization checks for GL2 compatibility.
 
    // Bind vertices
    gl.glBindBuffer(GL2.GL_ARRAY_BUFFER, verticesVboId[0]);
    gl.glVertexPointer(3, GL2.GL_FLOAT, 0, 0);

    // Bind texture coordinates
    if (numTextureUnits > 0)
    {
        Object texCoordsVboCacheKey = textureCoordVboCacheKeys.get(tile.density);
        int[] texCoordsVboId = (int[])
            (texCoordsVboCacheKey != null ? dc.getGpuResourceCache().get(texCoordsVboCacheKey) : null);
        if (texCoordsVboId == null)
            texCoordsVboId = this.fillTextureCoordsVbo(dc, tile.density, tile.ri.texCoords);
        for (int i = 0; i < numTextureUnits; i++)
        {
            gl.glClientActiveTexture(GL2.GL_TEXTURE0 + i);
            gl.glEnableClientState(GL2.GL_TEXTURE_COORD_ARRAY);

            gl.glBindBuffer(GL.GL_ARRAY_BUFFER, texCoordsVboId[0]);
            gl.glTexCoordPointer(2, GL.GL_FLOAT, 0, 0);
        }
    }

    // Bind index list
    Object indexListVboCacheKey = indexListsVboCacheKeys.get(tile.density);
    int[] indexListVboId = (int[])
        (indexListVboCacheKey != null ? dc.getGpuResourceCache().get(indexListVboCacheKey) : null);
    if (indexListVboId == null)
        indexListVboId = this.fillIndexListVbo(dc, tile.density, tile.ri.indices);
    if (indexListVboId != null)
        gl.glBindBuffer(GL.GL_ELEMENT_ARRAY_BUFFER, indexListVboId[0]);

    return indexListVboId != null;
}
 
開發者ID:iedadata,項目名稱:geomapapp,代碼行數:48,代碼來源:MYEBSRectangularTessellator.java

示例4: setPointer

import javax.media.opengl.GL2; //導入方法依賴的package包/類
/**
 *
 * @param openGl
 */
@Override
protected final void setPointer(final GL2 openGl) {
    openGl.glEnable(target());
    openGl.glTexCoordPointer(COORD_3D, GL2.GL_DOUBLE, NO_STRIDE, getBuffer());
}
 
開發者ID:Fidentis,項目名稱:Analyst,代碼行數:10,代碼來源:TextureCoordBuffer.java


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