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

This code example shows how to use the following methods:glBlendFunc, glColor4f, glPushMatrix, glScalef, glTranslatef
	 
	protected void preDraw(GL10 gl){
		if(gl instanceof GL11){
			GL11 gl11 = (GL11) gl;
			 
			gl11.glPushMatrix();
			gl11.glTranslatef(x, y, 0);
			gl11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE);
			gl11.glColor4f(0.0f, 0.7f, 0.0f, 1);
			gl11.glScalef(select_scale, select_scale, 1);			
		} else { 
			gl.glPushMatrix();
			gl.glTranslatef(x, y, 0);
			gl.glBlendFunc(GL10.GL_ONE, GL10.GL_ONE);
			gl.glColor4f(0.0f, 0.7f, 0.0f, 1);
			gl.glScalef(select_scale, select_scale, 1);
		} 
	} 
	 
	protected void onDraw(GL10 gl){
6
CodeRank
This code example shows how to use the following methods:glBlendFunc, glColor4x, glEnable, glLoadIdentity, glMatrixMode
        } 
    } 
 
    /* Called when the size of the window changes. */ 
    public void sizeChanged(GL10 gl, int width, int height) {
        gl.glViewport(0, 0, width, height);
 
        /* 
         * Set our projection matrix. This doesn't have to be done each time we 
         * draw, but usually a new projection needs to be set when the viewport 
         * is resized. 
         */ 
        gl.glMatrixMode(GL10.GL_PROJECTION);
        gl.glLoadIdentity();
        gl.glOrthof(0.0f, width, 0.0f, height, 0.0f, 1.0f);
         
        gl.glShadeModel(GL10.GL_FLAT);
        gl.glEnable(GL10.GL_BLEND);
        gl.glBlendFunc(GL10.GL_SRC_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA);
        gl.glColor4x(0x10000, 0x10000, 0x10000, 0x10000);

7
CodeRank
This code example shows how to use the following methods:glBlendFunc, glClear, glDisable, glEnable, glLoadIdentity
         * microedition.khronos.opengles.GL10) 
	 */ 
	public void onDrawFrame(GL10 gl) {
		 
		// Clears the screen and depth buffer. 
		gl.glClear(GL10.GL_COLOR_BUFFER_BIT | // OpenGL docs.
                           GL10.GL_DEPTH_BUFFER_BIT);
		 
	    gl.glBlendFunc(GL10.GL_SRC_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA);
		gl.glEnable(GL10.GL_BLEND);
		// gl.glAlphaFunc(GL10.GL_GREATER, 0.2f); 
		 
		 gl.glTexEnvf( GL10.GL_TEXTURE_ENV, GL10.GL_TEXTURE_ENV_MODE, GL10.GL_BLEND);
		  
		gl.glLoadIdentity();
		// Translates 4 units into the screen. 
		gl.glTranslatef(0, 0, -3.3f); 
		// Draw our square. 
		gl.glDisable(GL10.GL_BLEND);
		sq.draw(gl);

6
CodeRank
This code example shows how to use the following methods:glBlendFunc, glClearColor, glEnable, glEnableClientState
	/** 
	 * Startup 
	 */ 
    public void onSurfaceCreated(GL10 gl, EGLConfig config) {
        // Set the background frame color 
        gl.glClearColor(0f, 0f, 0f, 1f);
 
        // Alphablending 
	    gl.glEnable(GL10.GL_BLEND);
	    gl.glBlendFunc(GL10.GL_SRC_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA);
 
        // Enable use of vertex arrays 
        gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
         
        // create vertex buffer for test line 
        sensorLineVertexBuffer = ByteBuffer.allocateDirect(4*4).order(ByteOrder.nativeOrder()).asFloatBuffer();
    } 
     
     
    /** 
6
CodeRank
This code example shows how to use the following methods:glBlendFunc, glClearDepthf, glDepthFunc, glDisable, glEnable
     
     
    protected class Rendering extends RenderPrimitive { 
        @Override 
        public void render(RenderContext renderContext, GL10 gl) {
            gl.glDisable(GL10.GL_DEPTH_TEST);
            gl.glClearDepthf(1f);
            gl.glDepthFunc(GL10.GL_LEQUAL);
             
            gl.glBlendFunc(GL10.GL_SRC_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA);
 
            if ( enableTexture2D )
                gl.glEnable(GL10.GL_TEXTURE_2D);
        } 
    } 
} 
 
6
CodeRank
This code example shows how to use the following methods:glClientActiveTexture, glBindBuffer, glTexCoordPointer, glVertexPointer
This code example shows how to use the following methods:position
	//    offset - the offset in the vertex/index buffer to start at 
	//    numVertices - the number of vertices (indices) to draw 
	// R: [none] 
	public void drawFull(int primitiveType, int offset, int numVertices) {
		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:glBlendFunc, glClearColor, glClearDepthf, glDepthFunc, glEnable
        gl.glMatrixMode(GL10.GL_MODELVIEW);
	} 
 
	@Override 
	public void onSurfaceCreated(GL10 gl, EGLConfig config) {
		gl.glShadeModel(GL10.GL_SMOOTH);
		gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
		 
		gl.glClearDepthf(1.0f);
		gl.glEnable(GL10.GL_DEPTH_TEST);
		gl.glDepthFunc(GL10.GL_LEQUAL);
		 
		gl.glHint(GL10.GL_PERSPECTIVE_CORRECTION_HINT, GL10.GL_NICEST);
		 
		loadTexture(gl);
		 
		gl.glEnable(GL10.GL_BLEND);
        gl.glBlendFunc(GL10.GL_SRC_ALPHA, GL10.GL_ONE);
         
//		gl.glEnable(GL10.GL_LIGHT0); 

5
CodeRank
This code example shows how to use the following methods:glDrawElements, glEnable, glFrontFace, glTexCoordPointer, glVertexPointer
This code example shows how to use the following methods:glClearColor, glClearDepthf, glDepthFunc, glEnable, glHint
	/** 
	 * The Surface is created/init() 
	 */ 
	public void onSurfaceCreated(GL10 gl, EGLConfig config) {
 
		gl.glShadeModel(GL10.GL_SMOOTH); // Enable Smooth Shading
		gl.glClearColor(0.0f, 0.0f, 0.0f, 0.5f); // Black Background
		gl.glClearDepthf(1.0f); // Depth Buffer Setup
		gl.glEnable(GL10.GL_DEPTH_TEST); // Enables Depth Testing
		gl.glDepthFunc(GL10.GL_LEQUAL); // The Type Of Depth Testing To Do
 
		// Really Nice Perspective Calculations 
		gl.glHint(GL10.GL_PERSPECTIVE_CORRECTION_HINT, GL10.GL_NICEST);
 
	} 
 
	/** 
	 * Here we do our drawing 
	 */ 
	public void onDrawFrame(GL10 gl) {
8
CodeRank

Related GL10 glBlendFunc Questions & Answers: