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


Java GL2.glDrawElements方法代碼示例

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


在下文中一共展示了GL2.glDrawElements方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: draw

import javax.media.opengl.GL2; //導入方法依賴的package包/類
/**
 *
 * @param openGL
 * @param polygonMode
 * @param sides
 */
public final void draw(final GL2 openGL, final int polygonMode,
        final int sides) {

    asureIsBuffered(openGL);
    openGL.glEnableClientState(GL.GL_ELEMENT_ARRAY_BUFFER);
    openGL.glPolygonMode(sides, polygonMode);

    openGL.glDrawElements(primitive, getBufferCapacity(),
            GL.GL_UNSIGNED_INT, 0);

    openGL.glBindBuffer(target(), 0);
}
 
開發者ID:Fidentis,項目名稱:Analyst,代碼行數:19,代碼來源:IndexBuffer.java

示例3: drawLine

import javax.media.opengl.GL2; //導入方法依賴的package包/類
/**
 *
 * @param openGL
 * @param lineMode
 * @param sides
 */
public final void drawLine(final GL2 openGL, final int lineMode,
        final int sides) {

    asureIsBuffered(openGL);
    openGL.glEnableClientState(GL.GL_ELEMENT_ARRAY_BUFFER);

    openGL.glDrawElements(lineMode, getBufferCapacity(),
            GL.GL_UNSIGNED_INT, 0);

    openGL.glBindBuffer(target(), 0);
}
 
開發者ID:Fidentis,項目名稱:Analyst,代碼行數:18,代碼來源:IndexBuffer.java

示例4: draw

import javax.media.opengl.GL2; //導入方法依賴的package包/類
@Override
public void draw(GL2 gl) {
    if (texture != null) {
        texture.drawStart(gl);
    }
    gl.glBindBuffer(GL2.GL_ELEMENT_ARRAY_BUFFER, indexBufferName);
    gl.glDrawElements(shapeMode, indexbufferLength, BufferManager.INDEX_BUFFER_TYPE, BufferManager.INDEX_BUFFER_OFFSET);
    if (texture != null) {
        texture.drawEnd(gl);
    }
}
 
開發者ID:ABoschman,項目名稱:2IV60_RobotRace,代碼行數:12,代碼來源:Shape.java

示例5: drawPointsVBO

import javax.media.opengl.GL2; //導入方法依賴的package包/類
/**
 * Draws points at this path's specified positions.
 * <p/>
 * Note: when the draw context is in picking mode, this binds the current GL_ARRAY_BUFFER to 0
 * after using the currently bound GL_ARRAY_BUFFER to specify the vertex pointer. This does not
 * restore GL_ARRAY_BUFFER to the its previous state. If the caller intends to use that buffer
 * after this method returns, the caller must bind the buffer again.
 * 
 * @param dc
 *            the current draw context.
 * @param vboIds
 *            the ids of this shapes buffers.
 * @param pathData
 *            the current globe-specific path data.
 */
@Override
protected void drawPointsVBO(final DrawContext dc, final int[] vboIds, final PathData pathData) {

	final TourTrackConfig config = TourTrackConfigManager.getActiveConfig();

	if (config.isShowTrackPosition == false) {
		return;
	}

	final double d = getDistanceMetric(dc, pathData);
	if (d > getShowPositionsThreshold()) {
		return;
	}

	final IntBuffer posPoints = pathData.getPositionPoints();
	if (posPoints == null || posPoints.limit() < 1) {
		return;
	}

	final boolean useVertexColors = pathData.getTessellatedColors() != null && isShowTrackValueColor_Outline();

	final GL2 gl = dc.getGL().getGL2(); // GL initialization checks for GL2 compatibility.

	// Convert stride from number of elements to number of bytes.
	gl.glVertexPointer(3, GL2.GL_FLOAT, 4 * pathData.getVertexStride(), 0);

	if (dc.isPickingMode()) {

		gl.glEnableClientState(GL2.GL_COLOR_ARRAY);
		gl.glBindBuffer(GL2.GL_ARRAY_BUFFER, 0);
		gl.glColorPointer(3, GL2.GL_UNSIGNED_BYTE, 0, pickPositionColors);

	} else if (useVertexColors) {
		// Apply this path's per-position colors if we're in normal rendering mode (not picking) and this path's
		// positionColors is non-null. Convert the stride and offset from number of elements to number of bytes.
		gl.glEnableClientState(GL2.GL_COLOR_ARRAY);
		gl.glColorPointer(4, GL2.GL_FLOAT, 4 * pathData.getVertexStride(), 4 * pathData.getColorOffset());
	}

	prepareToDrawPoints(dc);

	gl.glBindBuffer(GL2.GL_ELEMENT_ARRAY_BUFFER, vboIds[2]);
	gl.glDrawElements(GL2.GL_POINTS, posPoints.limit(), GL2.GL_UNSIGNED_INT, 0);

	// Restore the previous GL point state.
	gl.glPointSize(1f);
	gl.glDisable(GL2.GL_POINT_SMOOTH);

	// Restore the previous GL color array state.
	if (dc.isPickingMode() || useVertexColors) {
		gl.glDisableClientState(GL2.GL_COLOR_ARRAY);
	}
}
 
開發者ID:wolfgang-ch,項目名稱:mytourbook,代碼行數:69,代碼來源:TrackPathOptimized.java


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