Java 8 GL10 - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 GL10 class.

This code example shows how to use the following methods:glDisable, glDisableClientState
      - 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);
        gl.glDisableClientState(GL10.GL_COLOR_ARRAY);
        gl.glDisableClientState(GL10.GL_TEXTURE_COORD_ARRAY);
        gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);
    } 
 
    /** @def CC_DIRECTOR_INIT 
      - Initializes an EAGLView with 0-bit depth format, and RGB565 render buffer. 
      - The EAGLView view will have multiple touches disabled. 
      - It will create a UIWindow and it will assign it the 'window' variable. 'window' must be declared before calling this marcro. 
      - It will parent the EAGLView to the created window 
      - If the firmware >= 3.1 it will create a Display Link Director. Else it will create an NSTimer director. 
      - It will try to run at 60 FPS. 
      - The FPS won't be displayed. 
      - The orientation will be portrait. 
8
CodeRank
Experience pair programming with AI  Get Codota for Java
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
Experience pair programming with AI  Get Codota for Java
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, glDisable, glEnable, glHint, 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.glHint(GL10.GL_PERSPECTIVE_CORRECTION_HINT,
                 GL10.GL_FASTEST);
 
         if (mTranslucentBackground) {
             gl.glClearColor(0,0,0,0);
         } else { 
             gl.glClearColor(1,1,1,1);
         } 
         gl.glEnable(GL10.GL_CULL_FACE);

8
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:glColorPointer, glDrawElements, glEnable, glFrontFace, glShadeModel
                mIndexBuffer.put(indices);
                mIndexBuffer.position(0);
            } 
 
            public void draw(GL10 gl) {
                gl.glEnable(GL10.GL_CULL_FACE);
                gl.glFrontFace(GL10.GL_CW);
                gl.glShadeModel(GL10.GL_SMOOTH);
                gl.glVertexPointer(3, GL10.GL_FLOAT, 0, mVertexBuffer);
                gl.glColorPointer(4, GL10.GL_FLOAT, 0, mColorBuffer);
                gl.glDrawElements(GL10.GL_TRIANGLES, 36, GL10.GL_UNSIGNED_BYTE, mIndexBuffer);
            }             
        } 
 
        public void onAccuracyChanged(Sensor sensor, int accuracy) {
        } 
    } 
} 
8
CodeRank
Experience pair programming with AI  Get Codota for Java
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
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:glBindTexture, glGenTextures, glTexImage2D, glTexParameterf, glTexParameterx
        } 
 
        private int createTargetTexture(GL10 gl, int width, int height) {
            int texture;
            int[] textures = new int[1];
            gl.glGenTextures(1, textures, 0);
            texture = textures[0];
            gl.glBindTexture(GL10.GL_TEXTURE_2D, texture);
            gl.glTexImage2D(GL10.GL_TEXTURE_2D, 0, GL10.GL_RGBA, width, height, 0,
                    GL10.GL_RGBA, GL10.GL_UNSIGNED_BYTE, null);
            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_LINEAR);
            gl.glTexParameterx(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_S,
                    GL10.GL_REPEAT);
            gl.glTexParameterx(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_T,
                    GL10.GL_REPEAT);
;            return texture;

8
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:glClientActiveTexture, glBindBuffer, glTexCoordPointer, glVertexPointer
    } 
 
    public void bindArrays(GL10 gl) {
        GL11 gl11 = (GL11) gl;
        // draw using hardware buffers 
        gl11.glBindBuffer(GL11.GL_ARRAY_BUFFER, mVertBufferIndex);
        gl11.glVertexPointer(3, GL11.GL_FLOAT, 0, 0);
 
        gl11.glBindBuffer(GL11.GL_ARRAY_BUFFER, mTextureCoordBufferIndex);
        gl11.glTexCoordPointer(2, GL11.GL_FLOAT, 0, 0);
        gl11.glClientActiveTexture(GL11.GL_TEXTURE1);
        gl11.glBindBuffer(GL11.GL_ARRAY_BUFFER, mSecTextureCoordBufferIndex);
        gl11.glTexCoordPointer(2, GL11.GL_FLOAT, 0, 0);
        gl11.glClientActiveTexture(GL11.GL_TEXTURE0);
        gl11.glBindBuffer(GL11.GL_ELEMENT_ARRAY_BUFFER, mIndexBufferIndex);
    } 
 
    public static final void draw(GL11 gl11) {
        // Don't call this method unless bindArrays was called. 
        gl11.glDrawElements(GL11.GL_TRIANGLE_STRIP, INDEX_COUNT, GL11.GL_UNSIGNED_SHORT, 0);
8
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:glDisableClientState, glDrawElements, glEnable, glEnableClientState, glTexCoordPointer
8
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:glFrustumf, glLoadIdentity, glMatrixMode, glViewport
    } 
 
    public void onSurfaceChanged(GL10 gl, int w, int h) {
        mWidth = w;
        mHeight = h;
        gl.glViewport(0, 0, w, h);
        mProjector.setCurrentView(0, 0, w, h);
 
        /* 
        * 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) w / h;
        gl.glMatrixMode(GL10.GL_PROJECTION);
        gl.glLoadIdentity();
        gl.glFrustumf(-ratio, ratio, -1, 1, 1, 10);
        mProjector.getCurrentProjection(gl);
    } 

8
CodeRank
Experience pair programming with AI  Get Codota for Java

Related Java 8 GL10 Questions & Answers: