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


Java GL10.glVertexPointer方法代碼示例

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


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

示例1: drawPoint

import javax.microedition.khronos.opengles.GL10; //導入方法依賴的package包/類
public void drawPoint(GL10 gl, Position3D p3Point, com.cyzapps.VisualMFP.Color color) {
	// 3d chart ignore point shape and size.
    gl.glColor4f(color.getF1R(), color.getF1G(), color.getF1B(), color.getF1Alpha());
    float vertices[] = {
            (float)p3Point.getX(), (float)p3Point.getY(), (float)p3Point.getZ()
            };
    ByteBuffer byteBuffer = ByteBuffer.allocateDirect(vertices.length * 4);
    byteBuffer.order(ByteOrder.nativeOrder());
    FloatBuffer vertexBuffer;
    vertexBuffer = byteBuffer.asFloatBuffer();
    vertexBuffer.put(vertices);
    // set the cursor position to the beginning of the buffer
    vertexBuffer.position(0);
    gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
    // Set the face rotation
    //gl.glFrontFace(GL10.GL_CW);
    // Point to our vertex buffer
    gl.glVertexPointer(3, GL10.GL_FLOAT, 0, vertexBuffer);
    // Draw the vertices as triangle strip
    gl.glDrawArrays(GL10.GL_POINTS, 0, vertices.length / 3);

    // Disable the client state before leaving
    gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);
}
 
開發者ID:woshiwpa,項目名稱:SmartMath,代碼行數:25,代碼來源:OGLChart.java

示例2: onDrawFrame

import javax.microedition.khronos.opengles.GL10; //導入方法依賴的package包/類
@Override
public void onDrawFrame(GL10 gl) {
    gl.glClearColor(1.f, 0.f, 0.f, 1.f);
    gl.glClear(GL10.GL_COLOR_BUFFER_BIT);

    gl.glLoadIdentity();
    gl.glTranslatef(0.f, 0.f, -50.f);

    long time = SystemClock.uptimeMillis() % 4000L;
    float angle = 0.090f * ((int) time);
    gl.glRotatef(angle, 0.f, 0.f, 1.f);

    gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
    gl.glColor4f(1.f, 1.f, 1.f, 1.f);
    gl.glVertexPointer(3, GL10.GL_FLOAT, 0, vertexBuffer);
    gl.glDrawElements(GL10.GL_TRIANGLES, indices.length, GL10.GL_UNSIGNED_SHORT, indexBuffer);

    gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);
}
 
開發者ID:PacktPublishing,項目名稱:Building-Android-UIs-with-Custom-Views,代碼行數:20,代碼來源:GLDrawerES1.java

示例3: drawLines

import javax.microedition.khronos.opengles.GL10; //導入方法依賴的package包/類
/**
 * 畫坐標
 * @param gl
 */
private void drawLines(GL10 gl){
	gl.glLineWidth(3f);
	float[] vertexArray = { -100, 0, 0, 100, 0, 0, 0, -100, 0, 0, 100, 0, 0, 0, -100, 0, 0, 100 };
	FloatBuffer lineBuffer = getFloatBufferFromArray(vertexArray);
	gl.glVertexPointer(3, GL10.GL_FLOAT, 0, lineBuffer);

	// X : red
	gl.glMaterialfv(GL10.GL_FRONT_AND_BACK, GL10.GL_AMBIENT, new float[] { 1.0f, 0f, 0f, 0.75f }, 0);
	gl.glMaterialfv(GL10.GL_FRONT_AND_BACK, GL10.GL_DIFFUSE, new float[] { 1.0f, 0f, 0f, 0.5f }, 0);
	gl.glDrawArrays(GL10.GL_LINES, 0, 2);

	// Y : blue
	gl.glMaterialfv(GL10.GL_FRONT_AND_BACK, GL10.GL_AMBIENT, new float[] { 0f, 0f, 1.0f, 0.75f }, 0);
	gl.glMaterialfv(GL10.GL_FRONT_AND_BACK, GL10.GL_DIFFUSE, new float[] { 0f, 0f, 1.0f, 0.5f }, 0);
	gl.glDrawArrays(GL10.GL_LINES, 2, 2);

	// Z : green
	gl.glMaterialfv(GL10.GL_FRONT_AND_BACK, GL10.GL_AMBIENT, new float[] { 0f, 1.0f, 0f, 0.75f }, 0);
	gl.glMaterialfv(GL10.GL_FRONT_AND_BACK, GL10.GL_DIFFUSE, new float[] { 0f, 1.0f, 0f, 0.5f }, 0);
	gl.glDrawArrays(GL10.GL_LINES, 4, 2);
}
 
開發者ID:xhd-Git,項目名稱:3DPrint-Controller,代碼行數:26,代碼來源:STLRenderer.java

示例4: draw

import javax.microedition.khronos.opengles.GL10; //導入方法依賴的package包/類
public void draw(GL10 gl) {
	if (normalList == null || triangleBuffer == null) {
		return;
	}
	
	gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
	gl.glEnableClientState(GL10.GL_NORMAL_ARRAY);
	//gl.glFrontFace(GL10.GL_CCW);
	gl.glVertexPointer(3, GL10.GL_FLOAT, 0, triangleBuffer);
	gl.glNormalPointer(GL10.GL_FLOAT,0, normalBuffer);
	gl.glDrawArrays(GL10.GL_TRIANGLES, 0, vertext_size*3);
	gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);
	gl.glDisableClientState(GL10.GL_NORMAL_ARRAY);
	

}
 
開發者ID:xhd-Git,項目名稱:3DPrint-Controller,代碼行數:17,代碼來源:STLObject.java

示例5: draw

import javax.microedition.khronos.opengles.GL10; //導入方法依賴的package包/類
/**
 * Encapsulates the OpenGL ES instructions for drawing this shape.
 *
 * @param gl - The OpenGL ES context in which to draw this shape.
 */
public void draw(GL10 gl) {
    // Since this shape uses vertex arrays, enable them
    gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);

    // draw the shape
    gl.glColor4f(       // set color
            color[0], color[1],
            color[2], color[3]);
    gl.glVertexPointer( // point to vertex data:
            COORDS_PER_VERTEX,
            GL10.GL_FLOAT, 0, vertexBuffer);
    gl.glDrawElements(  // draw shape:
            GL10.GL_TRIANGLES,
            drawOrder.length, GL10.GL_UNSIGNED_SHORT,
            drawListBuffer);

    // Disable vertex array drawing to avoid
    // conflicts with shapes that don't use it
    gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);
}
 
開發者ID:sdrausty,項目名稱:buildAPKsSamples,代碼行數:26,代碼來源:Square.java

示例6: draw

import javax.microedition.khronos.opengles.GL10; //導入方法依賴的package包/類
/**
 * Encapsulates the OpenGL ES instructions for drawing this shape.
 *
 * @param gl - The OpenGL ES context in which to draw this shape.
 */
public void draw(GL10 gl) {
    // Since this shape uses vertex arrays, enable them
    gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);

    // draw the shape
    gl.glColor4f(       // set color:
            color[0], color[1],
            color[2], color[3]);
    gl.glVertexPointer( // point to vertex data:
            COORDS_PER_VERTEX,
            GL10.GL_FLOAT, 0, vertexBuffer);
    gl.glDrawArrays(    // draw shape:
            GL10.GL_TRIANGLES, 0,
            triangleCoords.length / COORDS_PER_VERTEX);

    // Disable vertex array drawing to avoid
    // conflicts with shapes that don't use it
    gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);
}
 
開發者ID:sdrausty,項目名稱:buildAPKsSamples,代碼行數:25,代碼來源:Triangle.java

示例7: draw

import javax.microedition.khronos.opengles.GL10; //導入方法依賴的package包/類
@Override
    public void draw(GL10 gl){
        gl.glRotatef(45f,0,0,0);
        gl.glFrontFace(GL10.GL_CCW);
        gl.glEnable(GL10.GL_CULL_FACE);
        gl.glCullFace(GL10.GL_BACK);
        gl.glEnableClientState(GL10.GL_COLOR_ARRAY);
        gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
        gl.glVertexPointer(3, GL10.GL_FLOAT,0,mVertexBuffer);
        gl.glColorPointer(4,GL10.GL_FIXED,0,mColorBuffer);
//        gl.glDrawArrays(GL10.GL_TRIANGLES,0,3);
        gl.glDrawElements(GL10.GL_TRIANGLES,indices.length,GL10.GL_UNSIGNED_SHORT,mIndexBuffer);
//        gl.glDrawElements(GL10.GL_COLOR_ARRAY,colors.length,GL10.GL_FLOAT,mColorBuffer);

        gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);
        gl.glDisableClientState(GL10.GL_COLOR_ARRAY);
        gl.glDisable(GL10.GL_CULL_FACE);
    }
 
開發者ID:zhuangzaiku,項目名稱:AndroidCollection,代碼行數:19,代碼來源:Square.java

示例8: draw

import javax.microedition.khronos.opengles.GL10; //導入方法依賴的package包/類
@Override
    public void draw(GL10 gl){
        gl.glRotatef(45f,0,0,0);
        GLES20.glFrontFace(GL10.GL_CCW);
        GLES20.glEnable(GL10.GL_CULL_FACE);
        GLES20.glCullFace(GL10.GL_BACK);
        gl.glEnableClientState(GL10.GL_COLOR_ARRAY);
        gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
        gl.glVertexPointer(3, GL10.GL_FLOAT,0,mVertexBuffer);
        gl.glColorPointer(4,GL10.GL_FIXED,0,mColorBuffer);
//        gl.glDrawArrays(GL10.GL_TRIANGLES,0,3);
        GLES20.glDrawElements(GL10.GL_TRIANGLES,indices.length,GL10.GL_UNSIGNED_SHORT,mIndexBuffer);
//        gl.glDrawElements(GL10.GL_COLOR_ARRAY,colors.length,GL10.GL_FLOAT,mColorBuffer);

        gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);
        gl.glDisableClientState(GL10.GL_COLOR_ARRAY);
        GLES20.glDisable(GL10.GL_CULL_FACE);
    }
 
開發者ID:zhuangzaiku,項目名稱:AndroidCollection,代碼行數:19,代碼來源:Square20.java

示例9: draw

import javax.microedition.khronos.opengles.GL10; //導入方法依賴的package包/類
@Override
    public void draw(GL10 gl) {
        gl.glClearColor(1.0f,1.0f,1.0f,1.0f);
        if(shouldLoadTexture){
            loadTexture(gl);
            shouldLoadTexture = false;
        }
        if(mTextureId != -1 && mVertexBuffer != null){
            gl.glEnable(GL10.GL_TEXTURE_2D);
            gl.glEnableClientState(GL10.GL_TEXTURE_COORD_ARRAY);
            gl.glTexCoordPointer(2,GL10.GL_FLOAT,0,mVertexBuffer);
            gl.glBindTexture(GL10.GL_TEXTURE_2D,mTextureId);
        }
//        gl.glRotatef(180.0f,1,0,0);
        gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
        gl.glVertexPointer(2,GL10.GL_FLOAT,0,mVertexBuffer);
        gl.glDrawElements(GL10.GL_TRIANGLES, indices.length,
                GL10.GL_UNSIGNED_SHORT, mIndexBuffer);
//        gl.glDrawArrays(GL10.GL_TRIANGLES,0,4);
        gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);
        if(mTextureId != -1 && mVertexBuffer != null){
            gl.glDisableClientState(GL10.GL_TEXTURE_COORD_ARRAY);
            gl.glDisable(GL10.GL_TEXTURE_2D);
        }

    }
 
開發者ID:zhuangzaiku,項目名稱:AndroidCollection,代碼行數:27,代碼來源:Texture.java

示例10: draw

import javax.microedition.khronos.opengles.GL10; //導入方法依賴的package包/類
@Override
    public void draw(GL10 gl){
        gl.glRotatef(30f, 1, 0, 0);
        gl.glRotatef(30f, 0, 1, 0);
//        gl.glRotatef(45f, 0, 0, 1);
        gl.glFrontFace(GL10.GL_CCW);
        gl.glEnable(GL10.GL_CULL_FACE);
        gl.glCullFace(GL10.GL_BACK);
        gl.glEnableClientState(GL10.GL_COLOR_ARRAY);
        gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
        gl.glVertexPointer(3, GL10.GL_FLOAT,0,mVertexBuffer);
        gl.glColorPointer(4,GL10.GL_FIXED,0,mColorBuffer);
//        gl.glDrawArrays(GL10.GL_TRIANGLES,0,3);
        gl.glDrawElements(GL10.GL_TRIANGLES,indices.length,GL10.GL_UNSIGNED_SHORT,mIndexBuffer);
//        gl.glDrawElements(GL10.GL_COLOR_ARRAY,colors.length,GL10.GL_FLOAT,mColorBuffer);

        gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);
        gl.glDisableClientState(GL10.GL_COLOR_ARRAY);
        gl.glDisable(GL10.GL_CULL_FACE);
    }
 
開發者ID:zhuangzaiku,項目名稱:AndroidCollection,代碼行數:21,代碼來源:Cube.java

示例11: draw

import javax.microedition.khronos.opengles.GL10; //導入方法依賴的package包/類
public void draw(GL10 gl, float alpha) {

	    gl.glDisable(GL_TEXTURE_2D);
	    gl.glEnable(GL_BLEND);
		gl.glEnableClientState(GL_VERTEX_ARRAY);
		gl.glDisableClientState(GL_COLOR_ARRAY);

		// Use mColorBuffer as a global alpha mask:
		glTexEnvx(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL11.GL_COMBINE);
		glTexEnvx(GL_TEXTURE_ENV, GL11.GL_COMBINE_RGB, GL11.GL_REPLACE);
		glTexEnvx(GL_TEXTURE_ENV, GL11.GL_COMBINE_ALPHA, GL11.GL_MODULATE); // mix with alpha from glColor

		// Alpha from glColor will be used thanks to GL_MODULATE mode
		glColor4f(1f, 1f, 1f, 1f-alpha);

		glBlendFunc(GL_ZERO, GL_ONE_MINUS_SRC_ALPHA);

		gl.glVertexPointer(3, GL10.GL_FLOAT, 0, mFVertexBuffer);

		glDrawElements(GL_TRIANGLE_STRIP, VERTS, GL_UNSIGNED_SHORT, mIndexBuffer);
	}
 
開發者ID:archos-sa,項目名稱:aos-MediaLib,代碼行數:22,代碼來源:FadeOutVeil.java

示例12: drawLine

import javax.microedition.khronos.opengles.GL10; //導入方法依賴的package包/類
public void drawLine(GL10 gl, Position3D p3PrevPoint, Position3D p3NextPoint, com.cyzapps.VisualMFP.Color color) {
    // set the colour for the line
    gl.glColor4f(color.getF1R(), color.getF1G(), color.getF1B(), color.getF1Alpha());
    float vertices[] = {
            (float)p3PrevPoint.getX(), (float)p3PrevPoint.getY(), (float)p3PrevPoint.getZ(),
            (float)p3NextPoint.getX(), (float)p3NextPoint.getY(), (float)p3NextPoint.getZ(),

    };
    ByteBuffer byteBuffer = ByteBuffer.allocateDirect(vertices.length * 4);
    byteBuffer.order(ByteOrder.nativeOrder());
    FloatBuffer vertexBuffer;
    vertexBuffer = byteBuffer.asFloatBuffer();
    vertexBuffer.put(vertices);
    // set the cursor position to the beginning of the buffer
    vertexBuffer.position(0);
    gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
    // Set the face rotation
    //gl.glFrontFace(GL10.GL_CW);
    // Point to our vertex buffer
    gl.glVertexPointer(3, GL10.GL_FLOAT, 0, vertexBuffer);
    // Draw the vertices as triangle strip
    gl.glDrawArrays(GL10.GL_LINES, 0, vertices.length / 3);

    // Disable the client state before leaving
    gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);
}
 
開發者ID:woshiwpa,項目名稱:SmartMath,代碼行數:27,代碼來源:OGLChart.java

示例13: drawGrids

import javax.microedition.khronos.opengles.GL10; //導入方法依賴的package包/類
/**
 * 畫網格
 * @param gl
 */
private void drawGrids(GL10 gl) {
	List<Float> lineList = new ArrayList<Float>();
	
	for (int x = -100; x <= 100; x += 5) {
		lineList.add((float) x);
		lineList.add(-100f);
		lineList.add(0f);
		lineList.add((float)x);
		lineList.add(100f);
		lineList.add(0f);
	}
	for (int y = -100; y <= 100; y += 5) {
		lineList.add(-100f);
		lineList.add((float) y);
		lineList.add(0f);
		lineList.add(100f);
		lineList.add((float) y);
		lineList.add(0f);
	}

	FloatBuffer lineBuffer = getFloatBufferFromList(lineList);
	gl.glVertexPointer(3, GL10.GL_FLOAT, 0, lineBuffer);

	gl.glLineWidth(1f);
	gl.glMaterialfv(GL10.GL_FRONT_AND_BACK, GL10.GL_AMBIENT, new float[]{0.5f, 0.5f, 0.5f, 1.0f}, 0);
	gl.glMaterialfv(GL10.GL_FRONT_AND_BACK, GL10.GL_DIFFUSE, new float[]{0.5f, 0.5f, 0.5f, 1.0f}, 0);
	gl.glDrawArrays(GL10.GL_LINES, 0, lineList.size() / 3);
}
 
開發者ID:xhd-Git,項目名稱:3DPrint-Controller,代碼行數:33,代碼來源:STLRenderer.java

示例14: onDrawFrame

import javax.microedition.khronos.opengles.GL10; //導入方法依賴的package包/類
public void onDrawFrame(GL10 gl) {
    /*
     * Usually, the first thing one might want to do is to clear
     * the screen. The most efficient way of doing this is to use
     * glClear().
     */

    gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);

    /*
     * Now we're ready to draw some 3D objects
     */

    gl.glMatrixMode(GL10.GL_MODELVIEW);
    gl.glLoadIdentity();
    gl.glTranslatef(0, 0, -2);

    /*
     * All the magic happens here. The rotation matrix mR reported by
     * SensorManager.getRotationMatrix() is a 4x4 row-major matrix.
     * We need to use its inverse for rendering. The inverse is
     * simply calculated by taking the matrix' transpose. However, since
     * glMultMatrixf() expects a column-major matrix, we can use mR
     * directly!
     */
    gl.glMultMatrixf(mR, 0);
    // some test code which will be used/cleaned up before we ship this.
    //gl.glMultMatrixf(mI, 0);

    gl.glVertexPointer(3, GL_FLOAT, 0, mVertexBuffer);
    gl.glColorPointer(4, GL_FLOAT, 0, mColorBuffer);
    gl.glDrawElements(GL_LINES, 6, GL_UNSIGNED_BYTE, mIndexBuffer);
}
 
開發者ID:sdrausty,項目名稱:buildAPKsSamples,代碼行數:34,代碼來源:CompassActivity.java

示例15: draw

import javax.microedition.khronos.opengles.GL10; //導入方法依賴的package包/類
@Override
    public void draw(GL10 gl) {
//        gl.glColor4f(1.0f,0.0f,0.0f,1.0f);
//        gl.glPointSize(8.0f);
        gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
        gl.glEnableClientState(GL10.GL_COLOR_ARRAY);
        gl.glVertexPointer(3, GL10.GL_VERTEX_ARRAY,0,mVertexBuffer);
        gl.glColorPointer(4, GL10.GL_FIXED,0,mColorBuffer);
        gl.glDrawArrays(GL10.GL_POINTS,0,3);

        gl.glDisableClientState(GL10.GL_COLOR_ARRAY);
        gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);
    }
 
開發者ID:zhuangzaiku,項目名稱:AndroidCollection,代碼行數:14,代碼來源:Point.java


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