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

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:glColor4f, glDrawArrays, glMultMatrixf, glPopMatrix, glPushMatrix
        mLastAlpha = alpha;
        if (alpha >= 0.95f) {
            gl.glTexEnvf(GL11.GL_TEXTURE_ENV,
                    GL11.GL_TEXTURE_ENV_MODE, GL11.GL_REPLACE);
        } else { 
            gl.glTexEnvf(GL11.GL_TEXTURE_ENV,
                    GL11.GL_TEXTURE_ENV_MODE, GL11.GL_MODULATE);
            gl.glColor4f(alpha, alpha, alpha, alpha);
        } 
    } 
 
    public void drawRect(int x, int y, int width, int height) {
        float matrix[] = mMatrixValues;
        mTransformation.getMatrix().getValues(matrix);
        drawRect(x, y, width, height, matrix, mTransformation.getAlpha());
    } 
 
    private void drawRect( 
            int x, int y, int width, int height, float matrix[], float alpha) {
        GL11 gl = mGL;

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:glDisableClientState, glDrawArrays, glEnableClientState, glTexCoordPointer, glVertexPointer
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:glColor4f, glDrawArrays, glPopMatrix, glPushMatrix, glVertexPointer
			vbb.order(ByteOrder.nativeOrder());
			FloatBuffer vertexBuffer = vbb.asFloatBuffer();
			vertexBuffer.put(vertices);
			vertexBuffer.position(0);
			try{ 
						gl.glVertexPointer(2, GL10.GL_FLOAT, 0, vertexBuffer);	
			} 
			catch(Exception e){
				Log.e("exc", e.toString());
			} 
			gl.glPushMatrix();
			gl.glColor4f((float)color[0],(float)color[1],(float)color[2],(float)color[3]);
			gl.glDrawArrays(GL10.GL_LINE_LOOP, 0,2);
			gl.glPopMatrix();
	} 
	public  double[] calcCoefViaCenter(AGVector2D v){
		double A, B, C;
		 A = v.getY();
		 B = -v.getX();
		 C = 0;
6
CodeRank
This code example shows how to use the following methods:glColorPointer, glDisableClientState, glDrawArrays, glEnableClientState, glFrontFace
	 *  
	 * @param gl - The GL Context 
	 */ 
	public void draw(GL10 gl) {		
		//Set the face rotation 
		gl.glFrontFace(GL10.GL_CW);
		 
		//Point to our buffers 
		gl.glVertexPointer(3, GL10.GL_FLOAT, 0, vertexBuffer);
		gl.glColorPointer(4, GL10.GL_FLOAT, 0, colorBuffer);
		 
		//Enable the vertex and color state 
		gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
		gl.glEnableClientState(GL10.GL_COLOR_ARRAY);
		 
		//Draw the vertices as triangles 
		gl.glDrawArrays(GL10.GL_TRIANGLES, 0, vertices.length / 3);
		 
		//Disable the client state before leaving 
		gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);

6
CodeRank
This code example shows how to use the following methods:glColorPointer, glDisableClientState, glDrawArrays, glEnableClientState, glVertexPointer
			gl.glVertexPointer(3, GL10.GL_FLOAT, 0, mfBoxVtx);
			gl.glDrawArrays(GL10.GL_TRIANGLES, 0, VtxCnt);	
			gl.glDisable(GL10.GL_TEXTURE_2D);		
		}	 		 
		void DrawAxis(GL10 gl){
			gl.glEnableClientState(GL10.GL_COLOR_ARRAY);
			gl.glVertexPointer(3, GL10.GL_FLOAT, 0, mfbuf);
			gl.glColorPointer(4, GL10.GL_FLOAT, 0, mfAxisCol);
			gl.glDrawArrays(GL10.GL_LINES, 0, 6);
			gl.glDisableClientState(GL10.GL_COLOR_ARRAY);
		}	 		 
		void DrawMap(GL10 gl){
			gl.glEnableClientState(GL10.GL_COLOR_ARRAY);
			gl.glVertexPointer(3, GL10.GL_FLOAT, 0, mfMapBuf);	 
			gl.glColorPointer(4, GL10.GL_FLOAT, 0, mfMapCol);
			//gl.glColor4f(.5f, .5f, .5f, 1);  //ȸ»ö	 			 
			for(int i=-10; i<11; i++ ){
				gl.glLoadIdentity();
				gl.glTranslatef(0, 0, (float)i);
				gl.glDrawArrays(GL10.GL_LINES, 0, 2);
6
CodeRank
This code example shows how to use the following methods:glColorPointer, glDrawArrays, glEnableClientState, glVertexPointer
		}; 
		 
		FloatBuffer polygonVerticies = GraphicUtils.makeFloatBuffer(verticies);
		FloatBuffer polygonColors = GraphicUtils.makeFloatBuffer(colors);
		 
		gl.glVertexPointer(2, GL10.GL_FLOAT, 0, polygonVerticies);
		gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
		gl.glColorPointer(4, GL10.GL_FLOAT, 0, polygonColors);
		gl.glEnableClientState(GL10.GL_COLOR_ARRAY);
		gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, 0, 4);
		 
	} 
	 
	/** 
	 *  
	 * @param gl 
	 * @param x 
	 * @param y 
	 * @param width 
	 * @param height 
6
CodeRank
This code example shows how to use the following methods:glClientActiveTexture, glBindBuffer, glTexCoordPointer, glVertexPointer

Related GL10 glDrawArrays Questions & Answers: