当前位置: 首页>>代码示例>>Java>>正文


Java GL10.glColorPointer方法代码示例

本文整理汇总了Java中javax.microedition.khronos.opengles.GL10.glColorPointer方法的典型用法代码示例。如果您正苦于以下问题:Java GL10.glColorPointer方法的具体用法?Java GL10.glColorPointer怎么用?Java GL10.glColorPointer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.microedition.khronos.opengles.GL10的用法示例。


在下文中一共展示了GL10.glColorPointer方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: render

import javax.microedition.khronos.opengles.GL10; //导入方法依赖的package包/类
public void render(GL10 gl) {
    gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
    if (colorIndex>4) {
        gl.glEnableClientState(GL10.GL_COLOR_ARRAY);
    }
    else {
        gl.glDisableClientState(GL10.GL_COLOR_ARRAY);
    }

    gl.glVertexPointer(2, GL10.GL_FLOAT, 0, vertexBuffer);
    if (colorIndex>4) {
        gl.glColorPointer(4, GL10.GL_FLOAT, 0, colorBuffer);
    }
    else if (colorIndex==4) {
        // single color
        gl.glColor4f(
                colorComponents[0], colorComponents[1], colorComponents[2], colorComponents[3]);
    }

    gl.glDrawArrays(glMode, 0, numVertices);
}
 
开发者ID:StringMon,项目名称:homescreenarcade,代码行数:22,代码来源:GLVertexList.java

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

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

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

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

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

示例7: draw

import javax.microedition.khronos.opengles.GL10; //导入方法依赖的package包/类
/**
 * Draws this cube of the given GL-Surface
 * 
 * @param gl The GL-Surface this cube should be drawn upon.
 */
public void draw(GL10 gl) {
    gl.glEnable(GL10.GL_CULL_FACE);
    gl.glFrontFace(GL10.GL_CW);
    gl.glShadeModel(GL10.GL_SMOOTH);
    gl.glVertexPointer(3, GL10.GL_FLOAT, 0, mVertexBuffer);
    gl.glColorPointer(4, GL10.GL_FLOAT, 0, mColorBuffer);
    gl.glDrawElements(GL10.GL_TRIANGLES, 36, GL10.GL_UNSIGNED_BYTE, mIndexBuffer);
}
 
开发者ID:peter10110,项目名称:Android-SteamVR-controller,代码行数:14,代码来源:Cube.java

示例8: render

import javax.microedition.khronos.opengles.GL10; //导入方法依赖的package包/类
void render(GL10 gl, boolean DrawDest) {

		if (DRAW_TEXTURE && mPage.getTexturesChanged()) {
			mPage.recycle();
			reset();
		}
		// Some 'global' settings.
		gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);

		if (DRAW_TEXTURE) {
			gl.glEnableClientState(GL10.GL_TEXTURE_COORD_ARRAY);
			gl.glTexCoordPointer(2, GL10.GL_FLOAT, 0, mBufTexCoords);
		}
		gl.glVertexPointer(3, GL10.GL_FLOAT, 0, mBufVertices);
		// Enable color array.
		gl.glEnableClientState(GL10.GL_COLOR_ARRAY);
		gl.glColorPointer(4, GL10.GL_FLOAT, 0, mBufColors);
		gl.glDisable(GL10.GL_LIGHTING);
		gl.glDisable(GL10.GL_TEXTURE_2D);
		if (!DRAW_TEXTURE) {
			// inja khasiate transparent ro faAl mikonim ke betoonim too
			// CurlPage be kaaghaz alpha bedim
			gl.glEnable(GL10.GL_BLEND);
			gl.glBlendFunc(GL10.GL_SRC_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA);
			gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, 0, mVerticesCountFront);
		}
		// Draw front facing texture.
		if (DRAW_TEXTURE) {
			gl.glEnable(GL10.GL_BLEND);
			gl.glEnable(GL10.GL_TEXTURE_2D);
			gl.glBindTexture(GL10.GL_TEXTURE_2D, renderTex[0]);
			gl.glBlendFunc(GL10.GL_ONE_MINUS_DST_ALPHA, GL10.GL_ZERO);
			gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, 0, mVerticesCountFront);
			gl.glDisable(GL10.GL_BLEND);
			gl.glDisable(GL10.GL_TEXTURE_2D);
		}

		int backStartIdx = Math.max(0, mVerticesCountFront - 2);
		int backCount = mVerticesCountFront + mVerticesCountBack - backStartIdx;

		// Draw back facing blank vertices.
		if (!DRAW_TEXTURE) {
			// Added At 5/6/1394
			gl.glBlendFunc(GL10.GL_ONE, GL10.GL_ONE_MINUS_SRC_ALPHA);
			gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, backStartIdx, backCount);
		}

		// Draw back facing texture.
		if (DRAW_TEXTURE) {
			gl.glEnable(GL10.GL_BLEND);
			gl.glEnable(GL10.GL_TEXTURE_2D);
			gl.glBindTexture(GL10.GL_TEXTURE_2D, renderTex[0]);
			// Changed with gl.glBlendFunc(GLES10.GL_SRC_ALPHA,
			// GLES10.GL_ONE_MINUS_SRC_ALPHA); At 5/6/1394
			gl.glBlendFunc(GL10.GL_ONE, GL10.GL_ONE_MINUS_SRC_ALPHA);
			gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, backStartIdx, backCount);
			gl.glDisable(GL10.GL_BLEND);
			gl.glDisable(GL10.GL_TEXTURE_2D);
		}

		// Disable textures and color array.
		gl.glDisableClientState(GL10.GL_TEXTURE_COORD_ARRAY);
		gl.glDisableClientState(GL10.GL_COLOR_ARRAY);
		
		if (DRAW_POLYGON_OUTLINES_FRONT) {
			gl.glColor4f(0.0f, 0.0f, 0.0f, 1.0f);
			gl.glLineWidth(3.0f);
			gl.glVertexPointer(2, GL10.GL_FLOAT, 0, mBufOutFront);
			gl.glDrawArrays(GL10.GL_LINE_LOOP, 0, mOutFrontCount);
		}
		if (DRAW_DEST_POLY && DrawDest) {
			gl.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
			gl.glLineWidth(5.0f);
			gl.glVertexPointer(2, GL10.GL_FLOAT, 0, mBufDestVertices);
			gl.glDrawArrays(GL10.GL_LINE_LOOP, 0, mDesPoly.getNumPoints());

		}

		gl.glDisableClientState(GL10.GL_COLOR_ARRAY);
		gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);
	}
 
开发者ID:AmulaySoftGroup,项目名称:TaBeTa,代码行数:82,代码来源:CurlMesh.java

示例9: draw

import javax.microedition.khronos.opengles.GL10; //导入方法依赖的package包/类
public void draw(GL10 gl) {
	
	gl.glEnableClientState(GL_VERTEX_ARRAY);
	gl.glEnableClientState(GL_COLOR_ARRAY);

	gl.glDisableClientState(GL_TEXTURE_COORD_ARRAY); // Get a crash on K1 if this is not explicitly disabled
	gl.glDisable(GL_TEXTURE_2D);

	gl.glEnable(GL_BLEND);
	glBlendFunc(GL_ZERO, GL_ONE_MINUS_SRC_ALPHA); // mColorBuffer is used for its alpha only
	
	gl.glVertexPointer(3, GL10.GL_FLOAT, 0, mFVertexBuffer);
	gl.glColorPointer(4, GL10.GL_FIXED, 0, mColorBuffer);

	glDrawElements(GL_TRIANGLE_STRIP, VERTS, GL_UNSIGNED_SHORT, mIndexBuffer);
}
 
开发者ID:archos-sa,项目名称:aos-MediaLib,代码行数:17,代码来源:FadeOutBand.java


注:本文中的javax.microedition.khronos.opengles.GL10.glColorPointer方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。