本文整理匯總了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);
}
示例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());
}