GL10 glColorPointer - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for GL10 glColorPointer method.

This code example shows how to use the following methods:position
	//    USAGE: call once before calling draw() multiple times for this buffer. 
	// A: [none] 
	// R: [none] 
	public void bind() { 
		gl.glEnableClientState(GL10.GL_VERTEX_ARRAY); // Enable Position in Vertices
		vertices.position(0);                        // Set Vertex Buffer to Position
		gl.glVertexPointer(positionCnt, GL10.GL_FLOAT, vertexSize, vertices);  // Set Vertex Pointer
 
		if (hasColor) {                            // IF Vertices Have Color
			gl.glEnableClientState(GL10.GL_COLOR_ARRAY);  // Enable Color in Vertices
			vertices.position(positionCnt);            // Set Vertex Buffer to Color
			gl.glColorPointer(COLOR_CNT, GL10.GL_FLOAT, vertexSize, vertices);  // Set Color Pointer
		} 
 
		if (hasTexCoords) {                        // IF Vertices Have Texture Coords
			gl.glEnableClientState(GL10.GL_TEXTURE_COORD_ARRAY);  // Enable Texture Coords in Vertices
			vertices.position(positionCnt + (hasColor ? COLOR_CNT : 0));  // Set Vertex Buffer to Texture Coords (NOTE: position based on whether color is also specified)
			gl.glTexCoordPointer(TEXCOORD_CNT, GL10.GL_FLOAT, vertexSize, vertices);  // Set Texture Coords Pointer
		} 
 

7
CodeRank
This code example shows how to use the following methods:glDrawArrays, glBindBuffer, glColorPointer, glDrawElements, glVertexPointer
		} 
	} 
 
	public void draw(GL11 gl) {
		if (useVBO) {
			gl.glBindBuffer(GL11.GL_ARRAY_BUFFER, vertexVbo);
			gl.glVertexPointer(3, GL10.GL_FLOAT, 0, 0);
 
			gl.glBindBuffer(GL11.GL_ARRAY_BUFFER, colorVbo);
			gl.glColorPointer(4, GL10.GL_UNSIGNED_BYTE, 0, 0);
 
			gl.glBindBuffer(GL11.GL_ARRAY_BUFFER, 0);
			// gl.glDrawArrays(GL10.GL_LINE_STRIP, 0, N*N); 
 
			gl.glBindBuffer(GL11.GL_ELEMENT_ARRAY_BUFFER, vertexElementVbo);
			gl.glDrawElements(GL10.GL_LINE_STRIP, n * n, GL10.GL_UNSIGNED_SHORT, 0);
			gl.glBindBuffer(GL11.GL_ELEMENT_ARRAY_BUFFER, 0);
		} else { 
			gl.glVertexPointer(3, GL10.GL_FLOAT, 0, vertexBuf);
			gl.glColorPointer(4, GL10.GL_UNSIGNED_BYTE, 0, colorBuf);

7
CodeRank
This code example shows how to use the following methods:position
6
CodeRank
This code example shows how to use the following methods:position
6
CodeRank
This code example shows how to use the following methods:glColorPointer, glDrawElements, glEnable, glFrontFace, glShadeModel
This code example shows how to use the following methods:glColorPointer, glDrawElements, glFrontFace, glVertexPointer
This code example shows how to use the following methods:glClearColor, glColorPointer, glEnableClientState, glShadeModel, glVertexPointer
	private FloatBuffer mColorBuffer;
 
	public void onSurfaceCreated(GL10 gl, EGLConfig config) {
		Log.i(TAG_RENDER, "onSurfaceCreated");
		// preparation 
		gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
 
		mTriangleBuffer = createFloatBuffer(triangle);
		mColorBuffer = createFloatBuffer(colors);
		 
		gl.glClearColor (0.0f, 0.0f, 0.0f, 0.0f);
 
		gl.glVertexPointer(3, GL10.GL_FLOAT, 0, mTriangleBuffer);
		gl.glColorPointer(4, GL10.GL_FLOAT, 0, mColorBuffer);
		gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
		gl.glEnableClientState(GL10.GL_COLOR_ARRAY);
		 
		gl.glShadeModel(GL10.GL_FLAT);
	} 
 

6
CodeRank
This code example shows how to use the following methods:glColorPointer, glEnableClientState, glTexCoordPointer, glVertexPointer
6
CodeRank
This code example shows how to use the following methods:glColorPointer, glEnableClientState, glTexCoordPointer, glVertexPointer
6
CodeRank
This code example shows how to use the following methods:glColorPointer, glDrawElements, glFrontFace, glVertexPointer
	 * called by renderer drawframe 
	 *  
	 * @param gl 
	 */ 
	public void draw(GL10 gl) {
		gl.glFrontFace(GL11.GL_CW); // tell opengl to order their faces
		// stride to between two gl data so system can skip bwteen the gl data 
		// so the system can skip over it to the next bit 
		gl.glVertexPointer(2, GL11.GL_FLOAT, 0, mFVertexBuffer);
		gl.glColorPointer(4, GL11.GL_UNSIGNED_BYTE, 0, mColorBuffer);
		gl.glDrawElements(GL11.GL_TRIANGLES, 6, GL11.GL_UNSIGNED_BYTE,
				mIndexBuffer);//set triangles with 
		gl.glFrontFace(GL11.GL_CCW); // reset front face ordering back to GL_CCW
	} 
 
	private FloatBuffer mFVertexBuffer;
	private ByteBuffer mColorBuffer;
	private ByteBuffer mIndexBuffer;
} 
6
CodeRank

Related GL10 glColorPointer Questions & Answers: