GL10 glEnableClientState - 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 glEnableClientState method.

This code example shows how to use the following methods:glEnable, glEnableClientState
      - GL_VERTEX_ARRAY 
      - GL_TEXTURE_COORD_ARRAY 
      - GL_COLOR_ARRAY 
      */ 
    public static final void CC_ENABLE_DEFAULT_GL_STATES(GL10 gl) {
        gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
        gl.glEnableClientState(GL10.GL_COLOR_ARRAY);
        gl.glEnableClientState(GL10.GL_TEXTURE_COORD_ARRAY);
        gl.glEnable(GL10.GL_TEXTURE_2D);
    } 
 
    /** @def CC_DISABLE_DEFAULT_GL_STATES  
      Disable default GL states: 
      - GL_TEXTURE_2D 
      - GL_VERTEX_ARRAY 
      - GL_TEXTURE_COORD_ARRAY 
      - GL_COLOR_ARRAY 
      */ 
    public static final void CC_DISABLE_DEFAULT_GL_STATES(GL10 gl) {
        gl.glDisable(GL10.GL_TEXTURE_2D);
8
CodeRank
This code example shows how to use the following methods:glClearColor, glDisable, glEnable, glEnableClientState, glShadeModel
        /* 
         * By default, OpenGL enables features that improve quality 
         * but reduce performance. One might want to tweak that 
         * especially on software renderer. 
         */ 
        gl.glDisable(GL10.GL_DITHER);
 
        /* 
         * Some one-time OpenGL initialization can be made here 
         * probably based on features of this particular context 
         */ 
        gl.glClearColor(1,1,1,1);
        gl.glEnable(GL10.GL_CULL_FACE);
        gl.glShadeModel(GL10.GL_SMOOTH);
        gl.glEnable(GL10.GL_DEPTH_TEST);
 
        /* 
         * create / load the our 3D models here 
         */ 
 

8
CodeRank
This code example shows how to use the following methods:glDisableClientState, glDrawElements, glEnable, glEnableClientState, glTexCoordPointer
8
CodeRank
This code example shows how to use the following methods:glDisableClientState, glEnableClientState
7
CodeRank
This code example shows how to use the following methods:glColorPointer, glEnableClientState, glNormalPointer, glTexCoordPointer, glVertexPointer
	// D: perform all required binding/state changes before rendering batches. 
	//    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: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, glEnableClientState, glTexCoordPointer, glVertexPointer
6
CodeRank
This code example shows how to use the following methods:glColorPointer, glDrawArrays, glEnableClientState, glVertexPointer
		 */ 
		// 第一引数・・・1つの頂点に必要なデータ個数(2Dではx,yの2つの値で1つの座標となるため「2」を指定) 
		// 第二引数・・・第四引数に指定する頂点の配列のデータ型 
		// 第三引数・・・第四引数に渡した配列の何番目から読み込むかの指定なので基本的に0を指定する 
		// 第四引数・・・頂点の配列 
		gl.glVertexPointer(2, GL10.GL_FLOAT, 0, polygonVertices);
 
		gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
 
		// glVertexPointerと引数の指定方法は同じでRGBアルファをで1つの頂点となるため「4」を指定 
		gl.glColorPointer(4, GL10.GL_FLOAT, 0, polygonColors);
 
		gl.glEnableClientState(GL10.GL_COLOR_ARRAY);
 
		// ポリゴンを描画(一度に複数のポリゴンを描画できるため、どのようなルールで頂点をつないでいくかを第一引数で指定する) 
		// 最後の引数は頂点の数 
		gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, 0, 4);
	} 
 
	/** 

6
CodeRank
This code example shows how to use the following methods:glClear, glClearColor, glEnableClientState, glLoadIdentity, glMatrixMode
	 * Called every frame 
	 */ 
	@Override 
	public void onDrawFrame(GL10 gl) {
 
		gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
 
		gl.glClearColor(0.1f, 0.1f, 0.0f, 1f);
		gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
 
		gl.glMatrixMode(GL10.GL_MODELVIEW);
		gl.glLoadIdentity();
		gl.glTranslatef(0, 0, -5);
		 
		game.gameLoop();
		 
		game.drawFrame();
		 
	} 
 
6
CodeRank

Related GL10 glEnableClientState Questions & Answers: