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

The following examples show how to use processing.core.PGraphics#hint() . 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: PG.java    From haxademic with MIT License 6 votes vote down vote up
public static PGraphics newDataPG(int w, int h) {
//		PGraphics newPG = P.p.createGraphics(w, h, PRenderers.P3D);
//		PGraphics newPG = P.p.createGraphics(w, h, P.P32);
		PGraphics newPG = PGraphics32.createGraphics(P.p, w, h);
		newPG.noSmooth();
	    ((PGraphicsOpenGL)newPG).textureSampling(2);
		newPG.beginDraw();
//		newPG.hint(P.DISABLE_TEXTURE_MIPMAPS);
		newPG.hint(PConstants.DISABLE_DEPTH_SORT);
		newPG.hint(PConstants.DISABLE_DEPTH_TEST);
		newPG.hint(PConstants.DISABLE_DEPTH_MASK);
		newPG.background(0, 0);
		newPG.noStroke();
		newPG.endDraw();
		// moved these calls into this block for a full test of options
//		OpenGLUtil.setTextureQualityLow(newPG);		// necessary for proper texel lookup in GLSL!
//		OpenGLUtil.optimize2D(newPG);
		return newPG;
	}
 
Example 2
Source File: DwUtils.java    From PixelFlow with MIT License 5 votes vote down vote up
static public void beginScreen2D(PGraphics pg){
  pg.pushStyle();
  pg.hint(PConstants.DISABLE_DEPTH_TEST);
  pg.pushMatrix();
  pg.resetMatrix();
  if(pg.isGL() && pg.is3D()){
    PGraphicsOpenGL pgl = (PGraphicsOpenGL)pg;
    pushed_lights = pgl.lights;
    pgl.lights = false;
    pgl.pushProjection();
    pgl.ortho(0, pg.width, -pg.height, 0, -Float.MAX_VALUE, +Float.MAX_VALUE);
  }
}
 
Example 3
Source File: DwUtils.java    From PixelFlow with MIT License 5 votes vote down vote up
static public void endScreen2D(PGraphics pg){
  if(pg.isGL() && pg.is3D()){
    PGraphicsOpenGL pgl = (PGraphicsOpenGL)pg;
    pgl.popProjection();
    pgl.lights = pushed_lights;
  }
  pg.popMatrix();
  pg.hint(PConstants.ENABLE_DEPTH_TEST);
  pg.popStyle();
}
 
Example 4
Source File: PG.java    From haxademic with MIT License 5 votes vote down vote up
public static void setDrawFlat2d( PGraphics p, boolean is2d ) {
	if( is2d ) {
		p.hint( P.DISABLE_DEPTH_TEST );
	} else {
		p.hint( P.ENABLE_DEPTH_TEST );
	}
}
 
Example 5
Source File: OpenGLUtil.java    From haxademic with MIT License 4 votes vote down vote up
public static void setTextureQualityLow(PGraphics pg) {
    pg.hint(P.DISABLE_TEXTURE_MIPMAPS);
    ((PGraphicsOpenGL)pg).textureSampling(2);
}
 
Example 6
Source File: OpenGLUtil.java    From haxademic with MIT License 4 votes vote down vote up
public static void setTextureQualityHigh(PGraphics pg) {
	pg.hint(P.ENABLE_TEXTURE_MIPMAPS);
	((PGraphicsOpenGL)pg).textureSampling(5);
}
 
Example 7
Source File: OpenGLUtil.java    From haxademic with MIT License 4 votes vote down vote up
public static void optimize2D(PGraphics pg) {
	pg.hint(PConstants.DISABLE_DEPTH_SORT);
	pg.hint(PConstants.DISABLE_DEPTH_TEST);
	pg.hint(PConstants.DISABLE_DEPTH_MASK);
	// pg.hint(PConstants.DISABLE_OPTIMIZED_STROKE); // not helpful
}