Java Code Examples for javax.microedition.khronos.opengles.GL11#glTexEnvf()
The following examples show how to use
javax.microedition.khronos.opengles.GL11#glTexEnvf() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GLES11Canvas.java From PhotoMovie with Apache License 2.0 | 6 votes |
public GLState(GL11 gl) { mGL = gl; // Disable unused state gl.glDisable(GL11.GL_LIGHTING); // Enable used features gl.glEnable(GL11.GL_DITHER); gl.glEnableClientState(GL10.GL_VERTEX_ARRAY); gl.glEnableClientState(GL10.GL_TEXTURE_COORD_ARRAY); gl.glEnable(GL11.GL_TEXTURE_2D); gl.glTexEnvf(GL11.GL_TEXTURE_ENV, GL11.GL_TEXTURE_ENV_MODE, GL11.GL_REPLACE); // Set the background color gl.glClearColor(0f, 0f, 0f, 0f); gl.glClearStencil(0); gl.glEnable(GL11.GL_BLEND); gl.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); // We use 565 or 8888 format, so set the alignment to 2 bytes/pixel. gl.glPixelStorei(GL11.GL_UNPACK_ALIGNMENT, 2); }
Example 2
Source File: GLCanvasImpl.java From document-viewer with GNU General Public License v3.0 | 6 votes |
public GLState(final GL11 gl) { mGL = gl; // Disable unused state gl.glDisable(GL10.GL_LIGHTING); // Enable used features gl.glEnable(GL10.GL_DITHER); gl.glEnableClientState(GL10.GL_VERTEX_ARRAY); gl.glEnableClientState(GL10.GL_TEXTURE_COORD_ARRAY); gl.glEnable(GL10.GL_TEXTURE_2D); gl.glTexEnvf(GL10.GL_TEXTURE_ENV, GL10.GL_TEXTURE_ENV_MODE, GL10.GL_REPLACE); // Set the background color gl.glClearColor(0f, 0f, 0f, 0f); gl.glClearStencil(0); gl.glEnable(GL10.GL_BLEND); gl.glBlendFunc(GL10.GL_ONE, GL10.GL_ONE_MINUS_SRC_ALPHA); // We use 565 or 8888 format, so set the alignment to 2 bytes/pixel. gl.glPixelStorei(GL10.GL_UNPACK_ALIGNMENT, 2); }
Example 3
Source File: GLES11Canvas.java From PhotoMovie with Apache License 2.0 | 5 votes |
private void setMixedColor(int toColor, float ratio, float alpha) { // // The formula we want: // alpha * ((1 - ratio) * from + ratio * to) // // The formula that GL supports is in the form of: // combo * from + (1 - combo) * to * scale // // So, we have combo = alpha * (1 - ratio) // and scale = alpha * ratio / (1 - combo) // float combo = alpha * (1 - ratio); float scale = alpha * ratio / (1 - combo); // Specify the interpolation factor via the alpha component of // GL_TEXTURE_ENV_COLORs. // RGB component are get from toColor and will used as SRC1 float colorScale = scale * (toColor >>> 24) / (0xff * 0xff); setTextureColor(((toColor >>> 16) & 0xff) * colorScale, ((toColor >>> 8) & 0xff) * colorScale, (toColor & 0xff) * colorScale, combo); GL11 gl = mGL; gl.glTexEnvfv(GL11.GL_TEXTURE_ENV, GL11.GL_TEXTURE_ENV_COLOR, mTextureColor, 0); gl.glTexEnvf(GL11.GL_TEXTURE_ENV, GL11.GL_COMBINE_RGB, GL11.GL_INTERPOLATE); gl.glTexEnvf(GL11.GL_TEXTURE_ENV, GL11.GL_COMBINE_ALPHA, GL11.GL_INTERPOLATE); gl.glTexEnvf(GL11.GL_TEXTURE_ENV, GL11.GL_SRC1_RGB, GL11.GL_CONSTANT); gl.glTexEnvf(GL11.GL_TEXTURE_ENV, GL11.GL_OPERAND1_RGB, GL11.GL_SRC_COLOR); gl.glTexEnvf(GL11.GL_TEXTURE_ENV, GL11.GL_SRC1_ALPHA, GL11.GL_CONSTANT); gl.glTexEnvf(GL11.GL_TEXTURE_ENV, GL11.GL_OPERAND1_ALPHA, GL11.GL_SRC_ALPHA); // Wire up the interpolation factor for RGB. gl.glTexEnvf(GL11.GL_TEXTURE_ENV, GL11.GL_SRC2_RGB, GL11.GL_CONSTANT); gl.glTexEnvf(GL11.GL_TEXTURE_ENV, GL11.GL_OPERAND2_RGB, GL11.GL_SRC_ALPHA); // Wire up the interpolation factor for alpha. gl.glTexEnvf(GL11.GL_TEXTURE_ENV, GL11.GL_SRC2_ALPHA, GL11.GL_CONSTANT); gl.glTexEnvf(GL11.GL_TEXTURE_ENV, GL11.GL_OPERAND2_ALPHA, GL11.GL_SRC_ALPHA); }