Java Code Examples for android.opengl.GLES20#glUniform2f()

The following examples show how to use android.opengl.GLES20#glUniform2f() . 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: RippleFilterRender.java    From rtmp-rtsp-stream-client-java with Apache License 2.0 6 votes vote down vote up
@Override
protected void drawFilter() {
  GLES20.glUseProgram(program);

  squareVertex.position(SQUARE_VERTEX_DATA_POS_OFFSET);
  GLES20.glVertexAttribPointer(aPositionHandle, 3, GLES20.GL_FLOAT, false,
      SQUARE_VERTEX_DATA_STRIDE_BYTES, squareVertex);
  GLES20.glEnableVertexAttribArray(aPositionHandle);

  squareVertex.position(SQUARE_VERTEX_DATA_UV_OFFSET);
  GLES20.glVertexAttribPointer(aTextureHandle, 2, GLES20.GL_FLOAT, false,
      SQUARE_VERTEX_DATA_STRIDE_BYTES, squareVertex);
  GLES20.glEnableVertexAttribArray(aTextureHandle);

  GLES20.glUniformMatrix4fv(uMVPMatrixHandle, 1, false, MVPMatrix, 0);
  GLES20.glUniformMatrix4fv(uSTMatrixHandle, 1, false, STMatrix, 0);
  GLES20.glUniform2f(uResolutionHandle, getWidth(), getHeight());
  GLES20.glUniform1f(uSpeedHandle, speed);
  float time = ((float) (System.currentTimeMillis() - START_TIME)) / 1000f;
  if (time >= 10) START_TIME += 10000;
  GLES20.glUniform1f(uTimeHandle, time);
  GLES20.glUniform1i(uSamplerHandle, 4);
  GLES20.glActiveTexture(GLES20.GL_TEXTURE4);
  GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, previousTexId);
}
 
Example 2
Source File: GlVignetteFilter.java    From CameraRecorder-android with MIT License 5 votes vote down vote up
@Override
public void onDraw() {
    GLES20.glUniform2f(getHandle("vignetteCenter"), vignetteCenterX, vignetteCenterY);
    GLES20.glUniform3fv(getHandle("vignetteColor"), 0, vignetteColor, 0);
    GLES20.glUniform1f(getHandle("vignetteStart"), vignetteStart);
    GLES20.glUniform1f(getHandle("vignetteEnd"), vignetteEnd);
}
 
Example 3
Source File: GlSphereRefractionFilter.java    From GPUVideo-android with MIT License 5 votes vote down vote up
@Override
public void onDraw() {
    GLES20.glUniform2f(getHandle("center"), centerX, centerY);
    GLES20.glUniform1f(getHandle("radius"), radius);
    GLES20.glUniform1f(getHandle("aspectRatio"), aspectRatio);
    GLES20.glUniform1f(getHandle("refractiveIndex"), refractiveIndex);
}
 
Example 4
Source File: GlSphereRefractionFilter.java    From CameraRecorder-android with MIT License 5 votes vote down vote up
@Override
public void onDraw() {
    GLES20.glUniform2f(getHandle("center"), centerX, centerY);
    GLES20.glUniform1f(getHandle("radius"), radius);
    GLES20.glUniform1f(getHandle("aspectRatio"), aspectRatio);
    GLES20.glUniform1f(getHandle("refractiveIndex"), refractiveIndex);
}
 
Example 5
Source File: GlSphereRefractionFilter.java    From Mp4Composer-android with MIT License 5 votes vote down vote up
@Override
public void onDraw() {
    GLES20.glUniform2f(getHandle("center"), centerX, centerY);
    GLES20.glUniform1f(getHandle("radius"), radius);
    GLES20.glUniform1f(getHandle("aspectRatio"), aspectRatio);
    GLES20.glUniform1f(getHandle("refractiveIndex"), refractiveIndex);
}
 
Example 6
Source File: WatermarkShaderProgram.java    From Spectaculum with Apache License 2.0 5 votes vote down vote up
public void setWatermark(Texture2D watermarkTexture) {
    use();

    // Use TEXTURE1 for the watermark, TEXTURE0 is taken by the input
    GLES20.glActiveTexture(GLES20.GL_TEXTURE1);
    GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, watermarkTexture.getHandle());
    GLES20.glUniform1i(mWatermarkHandle, 1); // bind texture unit 1 to the uniform

    GLES20.glUniform2f(mWatermarkSizeHandle, watermarkTexture.getWidth(), watermarkTexture.getHeight());
}
 
Example 7
Source File: HalftoneLinesFilterRender.java    From rtmp-rtsp-stream-client-java with Apache License 2.0 5 votes vote down vote up
@Override
protected void drawFilter() {
  GLES20.glUseProgram(program);

  squareVertex.position(SQUARE_VERTEX_DATA_POS_OFFSET);
  GLES20.glVertexAttribPointer(aPositionHandle, 3, GLES20.GL_FLOAT, false,
      SQUARE_VERTEX_DATA_STRIDE_BYTES, squareVertex);
  GLES20.glEnableVertexAttribArray(aPositionHandle);

  squareVertex.position(SQUARE_VERTEX_DATA_UV_OFFSET);
  GLES20.glVertexAttribPointer(aTextureHandle, 2, GLES20.GL_FLOAT, false,
      SQUARE_VERTEX_DATA_STRIDE_BYTES, squareVertex);
  GLES20.glEnableVertexAttribArray(aTextureHandle);

  GLES20.glUniformMatrix4fv(uMVPMatrixHandle, 1, false, MVPMatrix, 0);
  GLES20.glUniformMatrix4fv(uSTMatrixHandle, 1, false, STMatrix, 0);
  GLES20.glUniform2f(uResolutionHandle, getWidth(), getHeight());
  GLES20.glUniform1f(uModeHandle, mode);
  GLES20.glUniform1f(uRowsHandle, rows);
  GLES20.glUniform1f(uRotationHandle, rotation);
  GLES20.glUniform1f(uAntialiasHandle, antialias);
  GLES20.glUniform2f(uSampleDistHandle, sampleDist[0], sampleDist[1]);

  GLES20.glUniform1i(uSamplerHandle, 4);
  GLES20.glActiveTexture(GLES20.GL_TEXTURE4);
  GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, previousTexId);
}
 
Example 8
Source File: Uniform.java    From remixed-dungeon with GNU General Public License v3.0 4 votes vote down vote up
public void value2f( float v1, float v2 ) {
	GLES20.glUniform2f( location, v1, v2 );
}
 
Example 9
Source File: GlVignetteFilter.java    From GPUVideo-android with MIT License 4 votes vote down vote up
@Override
public void onDraw() {
    GLES20.glUniform2f(getHandle("vignetteCenter"), vignetteCenterX, vignetteCenterY);
    GLES20.glUniform1f(getHandle("vignetteStart"), vignetteStart);
    GLES20.glUniform1f(getHandle("vignetteEnd"), vignetteEnd);
}
 
Example 10
Source File: ShaderProgram.java    From tilt-game-android with MIT License 4 votes vote down vote up
public void setUniformOptional(final String pUniformName, final float pX, final float pY) {
	final int location = this.getUniformLocationOptional(pUniformName);
	if (location != ShaderProgramConstants.LOCATION_INVALID) {
		GLES20.glUniform2f(this.getUniformLocationOptional(pUniformName), pX, pY);
	}
}
 
Example 11
Source File: Uniform.java    From PD-classes with GNU General Public License v3.0 4 votes vote down vote up
public void value2f( float v1, float v2 ) {
	GLES20.glUniform2f( location, v1, v2 );
}
 
Example 12
Source File: AtkinsonShader.java    From retroboy with MIT License 4 votes vote down vote up
@Override
public void draw() {
       // Transfer the output image size
       GLES20.glUniform2f(_targetSizeLocation, _targetSize[0], _targetSize[1]);
       checkGlError("glUniform2f sTargetSize");
}
 
Example 13
Source File: MosaicFilter.java    From UltimateAndroid with Apache License 2.0 votes vote down vote up
@Override
	protected void passShaderValues() {
		super.passShaderValues();
		GLES20.glUniform2f(inputTileSizeHandle, inputTileSize.x, inputTileSize.y);
		GLES20.glUniform2f(displayTileSizeHandle, displayTileSize.x, displayTileSize.y);
		GLES20.glUniform1i(numOfTilesHandle, numOfTiles);
		if(color) {
			GLES20.glUniform1i(colorHandle, 1);
		} else {
			GLES20.glUniform1i(colorHandle, 0);
		}
	} 
Example 14
Source File: GaussianBlurPositionFilter.java    From UltimateAndroid with Apache License 2.0 votes vote down vote up
@Override
	protected void passShaderValues() {
		super.passShaderValues();
		GLES20.glUniform1f(blurSizeHandle, blurSize);
		GLES20.glUniform1f(aspectRatioHandle, aspectRatio);
		GLES20.glUniform1f(excludedCircleRadiusHandle, excludedCircleRadius);
		GLES20.glUniform2f(excludedCirclePointHandle, excludedCirclePoint.x, excludedCirclePoint.y);
	} 
Example 15
Source File: ZoomBlurFilter.java    From UltimateAndroid with Apache License 2.0 votes vote down vote up
@Override
	protected void passShaderValues() {
		super.passShaderValues();
		GLES20.glUniform1f(blurSizeHandle, blurSize);
		GLES20.glUniform2f(blurLocationHandle, blurLocation.x, blurLocation.y);
	} 
Example 16
Source File: VignetteFilter.java    From AndroidFastImageProcessing with MIT License votes vote down vote up
@Override
	protected void passShaderValues() {
		super.passShaderValues();
		GLES20.glUniform2f(centerHandle, center.x, center.y);
		GLES20.glUniform3f(colourHandle, colour[0], colour[1], colour[2]);
		GLES20.glUniform1f(startHandle, start);
		GLES20.glUniform1f(endHandle, end);
	} 
Example 17
Source File: MosaicFilter.java    From AndroidFastImageProcessing with MIT License votes vote down vote up
@Override
	protected void passShaderValues() {
		super.passShaderValues();
		GLES20.glUniform2f(inputTileSizeHandle, inputTileSize.x, inputTileSize.y);
		GLES20.glUniform2f(displayTileSizeHandle, displayTileSize.x, displayTileSize.y);
		GLES20.glUniform1i(numOfTilesHandle, numOfTiles);
		if(color) {
			GLES20.glUniform1i(colorHandle, 1);
		} else {
			GLES20.glUniform1i(colorHandle, 0);
		}
	} 
Example 18
Source File: SwirlFilter.java    From UltimateAndroid with Apache License 2.0 votes vote down vote up
@Override
	protected void passShaderValues() {
		super.passShaderValues();
		GLES20.glUniform2f(centerHandle, center.x, center.y);
		GLES20.glUniform1f(radiusHandle, radius);
		GLES20.glUniform1f(angleHandle, angle);
	} 
Example 19
Source File: ZoomBlurFilter.java    From UltimateAndroid with Apache License 2.0 votes vote down vote up
@Override
	protected void passShaderValues() {
		super.passShaderValues();
		GLES20.glUniform1f(blurSizeHandle, blurSize);
		GLES20.glUniform2f(blurLocationHandle, blurLocation.x, blurLocation.y);
	} 
Example 20
Source File: VignetteFilter.java    From UltimateAndroid with Apache License 2.0 votes vote down vote up
@Override
	protected void passShaderValues() {
		super.passShaderValues();
		GLES20.glUniform2f(centerHandle, center.x, center.y);
		GLES20.glUniform3f(colourHandle, colour[0], colour[1], colour[2]);
		GLES20.glUniform1f(startHandle, start);
		GLES20.glUniform1f(endHandle, end);
	}