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


Java GL2.glNormalPointer方法代碼示例

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


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

示例1: 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

示例2: setPointer

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


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