Example #1
0
 void SetTextureEnvMODE(float value) {
   // void glTexEnv{if}(GLenum target, GLenum pname, TYPEparam);
   // void glTexEnv{if}v(GLenum target, GLenum pname, TYPE *param);
   ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
   // Sets the current texturing function. target must be GL_TEXTURE_ENV. If pname is
   // GL_TEXTURE_ENV_MODE, param can be
   // GL_DECAL, GL_REPLACE, GL_MODULATE, or GL_BLEND, to specify how texture values are to be
   // combined with the color
   // values of the fragment being processed. If pname is GL_TEXTURE_ENV_COLOR, param is an array
   // of four floating-point values
   // representing R, G, B, and A components. These values are used only if the GL_BLEND texture
   // function has been specified
   // as well.
   // static void	 glTexEnvf(int target, int pname, float param)
   GLES10.glTexEnvf(GLES10.GL_TEXTURE_ENV, GLES10.GL_TEXTURE_ENV_MODE, value);
 }
  public void onSurfaceCreated(GL10 gl, EGLConfig config) {
    /*
     * By default, OpenGL enables features that improve quality
     * but reduce performance. One might want to tweak that
     * especially on software renderer.
     */
    glDisable(GL_DITHER);

    /*
     * Some one-time OpenGL initialization can be made here
     * probably based on features of this particular context
     */
    glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST);

    glClearColor(.5f, .5f, .5f, 1);
    glShadeModel(GL_SMOOTH);
    glEnable(GL_DEPTH_TEST);
    glEnable(GL_TEXTURE_2D);

    /*
     * Create our texture. This has to be done each time the
     * surface is created.
     */

    int[] textures = new int[1];
    glGenTextures(1, textures, 0);

    mTextureID = textures[0];
    glBindTexture(GL_TEXTURE_2D, mTextureID);

    glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
    glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);

    glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
    glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);

    glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
    mTextureLoader.load(gl);
  }