Java Code Examples for processing.core.PGraphics#textureWrap()

The following examples show how to use processing.core.PGraphics#textureWrap() . 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: ShaderBasicTest.java    From haxademic with MIT License 4 votes vote down vote up
protected void drawApp() {
		background(0, 0, 0);
	
		// rendering progress
		float percentComplete = ((float)(p.frameCount%_frames)/_frames);
		float radsComplete = P.TWO_PI * percentComplete;

		_timeEaser.update();
		_timeEaseInc = _timeEaser.value();

		applyTime( _textureShader );
		// applyResolution( _textureShader );
		// applyMouse( _textureShader );
		
		
		_buffer.filter( _textureShader );		
		PGraphics filterTargetCanvas = _buffer;
		
//		ColorCorrectionFilter.instance(p).setBrightness(0.1f * P.cos(radsComplete));
//		ColorCorrectionFilter.instance(p).setContrast(1f + 0.1f * P.sin(radsComplete));
//		ColorCorrectionFilter.instance(p).setGamma(1f + 0.2f * P.sin(radsComplete));
//		ColorCorrectionFilter.instance(p).applyTo(filterTargetCanvas);

//		BrightnessFilter.instance(p).setBrightness(1f + 0.5f * P.sin(radsComplete));
//		BrightnessFilter.instance(p).applyTo(filterTargetCanvas);
//		VignetteFilter.instance(p).setDarkness(-0.75f + 0.25f * P.sin(radsComplete));
//		VignetteFilter.instance(p).applyTo(filterTargetCanvas);
//		BlurHFilter.instance(p).applyTo(filterTargetCanvas);
//		BlurHFilter.instance(p).setBlur(1f / (filterTargetCanvas.width*1.2f + filterTargetCanvas.width * P.cos(radsComplete)));
//		BlurVFilter.instance(p).applyTo(filterTargetCanvas);
//		BlurVFilter.instance(p).setBlur(1f / (filterTargetCanvas.width*1.2f + filterTargetCanvas.width * P.cos(radsComplete)));

//		WobbleFilter.instance(p).setTime( _timeEaseInc * 2f);
//		WobbleFilter.instance(p).setSpeed( 1.0f + 0.5f * P.sin(radsComplete));
//		WobbleFilter.instance(p).setStrength( 0.001f + 0.0005f * P.sin(radsComplete));
//		WobbleFilter.instance(p).setSize( 200f + 25f * P.sin(radsComplete));
//		WobbleFilter.instance(p).applyTo(filterTargetCanvas);
//		KaleidoFilter.instance(p).setAngle(radsComplete);
//		KaleidoFilter.instance(p).setSides(P.round(6 + 2f * P.sin(radsComplete)));
		KaleidoFilter.instance(p).applyTo(filterTargetCanvas);
		ReflectFilter.instance(p).applyTo(filterTargetCanvas);
//		InvertFilter.instance(p).applyTo(filterTargetCanvas);
//		RadialRipplesFilter.instance(p).setTime( _timeEaseInc / 5f);
//		RadialRipplesFilter.instance(p).setAmplitude(0.4f + 0.4f * P.sin(radsComplete));
//		RadialRipplesFilter.instance(p).applyTo(filterTargetCanvas);
//		DeformTunnelFanFilter.instance(p).setTime(p.frameCount / 40f);
//		DeformTunnelFanFilter.instance(p).applyTo(p);
//		SphereDistortionFilter.instance(p).setAmplitude(0.45f + 0.45f * P.sin(radsComplete));
//		SphereDistortionFilter.instance(p).applyTo(filterTargetCanvas);
//		ColorDistortionFilter.instance(p).setTime( _timeEaseInc / 5f);
//		ColorDistortionFilter.instance(p).setAmplitude(1.5f + 1.5f * P.sin(radsComplete));
//		ColorDistortionFilter.instance(p).applyTo(filterTargetCanvas);
//		WarperFilter.instance(p).setTime( _timeEaseInc / 5f);
//		WarperFilter.instance(p).applyTo(filterTargetCanvas);
//		OpenGLUtil.setTextureRepeat(_buffer);
//		HalftoneFilter.instance(p).applyTo(filterTargetCanvas);
//		CubicLensDistortionFilter.instance(p).setTime( _timeEaseInc);
//		CubicLensDistortionFilter.instance(p).applyTo(filterTargetCanvas);

//		ThresholdFilter.instance(p).applyTo(filterTargetCanvas);
//		FXAAFilter.instance(p).applyTo(filterTargetCanvas);
//		EmbossFilter.instance(p).applyTo(filterTargetCanvas);
//		RadialBlurFilter.instance(p).setTime( _timeEaseInc / 5f);
//		RadialBlurFilter.instance(p).applyTo(filterTargetCanvas);
//		ChromaColorFilter.instance(p).applyTo(filterTargetCanvas);
//		SaturationFilter.instance(p).setSaturation(1f + 1f * P.sin(radsComplete));
//		SaturationFilter.instance(p).setSaturation(0);
//		SaturationFilter.instance(p).applyTo(filterTargetCanvas);

//		HueFilter.instance(p).setHue(360f * percentComplete);
//		HueFilter.instance(p).applyTo(filterTargetCanvas);
		BadTVLinesFilter.instance(p).applyTo(filterTargetCanvas);
//		EdgesFilter.instance(p).applyTo(filterTargetCanvas);
//		EdgeColorFadeFilter.instance(p).setSpreadX(0.65f);
//		EdgeColorFadeFilter.instance(p).setSpreadY(0.65f);
//		EdgeColorFadeFilter.instance(p).applyTo(filterTargetCanvas);
//		EdgeColorDarkenFilter.instance(p).setSpreadX(0.3f);
//		EdgeColorDarkenFilter.instance(p).setSpreadY(0.3f);
//		EdgeColorDarkenFilter.instance(p).applyTo(filterTargetCanvas);
//		PixelateFilter.instance(p).setDivider(8f, filterTargetCanvas.width, filterTargetCanvas.height);
//		PixelateFilter.instance(p).applyTo(filterTargetCanvas);
//		ContrastFilter.instance(p).setContrast(1.2f);
//		ContrastFilter.instance(p).applyTo(filterTargetCanvas);

		ColorizeTwoColorsFilter.instance(p).setColor1(1f, 1f, 0f);
		ColorizeTwoColorsFilter.instance(p).setColor2(0f, 1f, 1f);
		ColorizeTwoColorsFilter.instance(p).setCrossfadeMode(0);
		ColorizeTwoColorsFilter.instance(p).applyTo(filterTargetCanvas);
		
		filterTargetCanvas.textureWrap(Texture.REPEAT);
//		RotateFilter.instance(p).setAspect(filterTargetCanvas.width, filterTargetCanvas.height);
		RotateFilter.instance(p).setRotation(p.frameCount * 0.01f);
		RotateFilter.instance(p).setZoom(1f + 0.25f * P.sin(p.frameCount * 0.01f));
		RotateFilter.instance(p).setOffset(0.5f * P.cos(P.PI + p.frameCount * 0.01f), 0.5f * P.sin(p.frameCount * -0.01f));
		RotateFilter.instance(p).applyTo(filterTargetCanvas);

//		filterTargetCanvas.filter(_postFilter);
		
		
		p.image( _buffer, 0, 0);
	}
 
Example 2
Source File: PG.java    From haxademic with MIT License 4 votes vote down vote up
public static void setTextureRepeat(PGraphics pg, boolean doesRepeat) {
	if( doesRepeat == true ) 
		pg.textureWrap(Texture.REPEAT);
	else 
		pg.textureWrap(Texture.CLAMP);
}
 
Example 3
Source File: OpenGLUtil.java    From haxademic with MIT License 4 votes vote down vote up
public static void setTextureRepeat(PGraphics pg) {
	pg.textureWrap(Texture.REPEAT);
}