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

This code example shows how to use the following methods:glActiveTexture, glDisable, glFrustumf, glLoadIdentity, glMatrixMode
 
        mWorld.draw(gl);
    } 
 
    public void onSurfaceChanged(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. 
         */ 
 
        float ratio = (float)width / height;
        gl.glMatrixMode(GL10.GL_PROJECTION);
        gl.glLoadIdentity();
        gl.glFrustumf(-ratio, ratio, -1, 1, 2, 12);
 
        /* 
         * By default, OpenGL enables features that improve quality 

7
CodeRank
This code example shows how to use the following methods:glActiveTexture, glBindTexture, glTexParameterf
    		imageWidth  = (float)bitmap.getWidth();
    		imageHeight = (float)bitmap.getHeight();
    	} 
 
        // Ladataan bitmap OpenGL-tekstuuriksi 
        _gl.glBindTexture(GL10.GL_TEXTURE_2D, sprites[0]);
        _gl.glActiveTexture(sprites[0]);
         
         
        if (isClamped) {
	        // TODO: TÄHÄN TULEE SAMA KUIN ALLA, HIEMAN MUUTETTUNA (KATSO NETTITUTORIAALI!) 
        	//_gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_T, GL10.GL_CLAMP_TO_EDGE); 
	        _gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_S, GL10.GL_REPEAT);
	        _gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MIN_FILTER, GL10.GL_NEAREST);
	        _gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MAG_FILTER, GL10.GL_NEAREST);
        } 
        else { 
        	_gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MIN_FILTER, GL10.GL_NEAREST);
	        _gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MAG_FILTER, GL10.GL_NEAREST);
        } 

6
CodeRank
This code example shows how to use the following methods:glActiveTexture, glDisable, glFrustumf, glLoadIdentity, glMatrixMode
 
        mWorld.draw(gl);
    } 
 
    public void onSurfaceChanged(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. 
         */ 
 
        float ratio = (float)width / height;
        gl.glMatrixMode(GL10.GL_PROJECTION);
        gl.glLoadIdentity();
        gl.glFrustumf(-ratio, ratio, -1, 1, 2, 12);
 
        /* 
         * By default, OpenGL enables features that improve quality 

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:glActiveTexture, glBindTexture, glGenTextures, glTexParameterf
	} 
 
	public static final int loadTexture(GL10 gl, Bitmap bmp){
        //テクスチャメモリの確保 
		int[] textureIds=new int[1];
		gl.glGenTextures(1,textureIds,0);
		//テクスチャへのビットマップ指定 
		gl.glActiveTexture(GL10.GL_TEXTURE0);
		gl.glBindTexture(GL10.GL_TEXTURE_2D, textureIds[0]);
		GLUtils.texImage2D(GL10.GL_TEXTURE_2D, 0, bmp, 0);
		//テクスチャフィルタの指定 
		gl.glTexParameterf(GL10.GL_TEXTURE_2D,
				GL10.GL_TEXTURE_MIN_FILTER,GL10.GL_NEAREST);
		gl.glTexParameterf(GL10.GL_TEXTURE_2D,
				GL10.GL_TEXTURE_MAG_FILTER,GL10.GL_NEAREST);
		return textureIds[0];
	} 
} 
6
CodeRank
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:glDrawElements, glEnable, glFrontFace, glTexCoordPointer, glVertexPointer
This code example shows how to use the following methods:glActiveTexture, glBindTexture, glDrawElements, glEnable, glFrontFace
			try { 
				albumCoverFileInputStream = new FileInputStream("/sdcard/albumthumbs/RockOn/small/Ingrid Michaelson - Be OK");
				bm = BitmapFactory.decodeStream(albumCoverFileInputStream);
 
				/** load texture */ 
				gl.glBindTexture(
						gl.GL_TEXTURE_2D, 
						99 // our texture ID 
				); 
				GLUtils.texImage2D(
							gl.GL_TEXTURE_2D, 
							0, // detail level 
							bm, //bitmap
							0 // border 
				); 
				 
			} catch (FileNotFoundException e) {
				e.printStackTrace();
			} 
 

6
CodeRank
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
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

Related GL10 glActiveTexture Questions & Answers: