当前位置: 首页>>代码示例>>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;未经允许,请勿转载。