當前位置: 首頁>>代碼示例>>Java>>正文


Java FrameBuffer.getColorBufferTexture方法代碼示例

本文整理匯總了Java中com.badlogic.gdx.graphics.glutils.FrameBuffer.getColorBufferTexture方法的典型用法代碼示例。如果您正苦於以下問題:Java FrameBuffer.getColorBufferTexture方法的具體用法?Java FrameBuffer.getColorBufferTexture怎麽用?Java FrameBuffer.getColorBufferTexture使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.badlogic.gdx.graphics.glutils.FrameBuffer的用法示例。


在下文中一共展示了FrameBuffer.getColorBufferTexture方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: setLightSource

import com.badlogic.gdx.graphics.glutils.FrameBuffer; //導入方法依賴的package包/類
public AbsStdLight setLightSource(EscapyLightType light) {

		this.updState();
		this.lightSource = light;
		this.interCam = new EscapyGdxCamera((int) this.lightSource.getWidth(), (int) this.lightSource.getHeight());
		this.fbo = new StandartFBO(id, (int) this.lightSource.getWidth(), (int) this.lightSource.getHeight(), "<AbsLightTexture_FBUFFER>");
		FrameBuffer tmpBuff = new FrameBuffer(Pixmap.Format.RGBA8888, (int) this.lightSource.getWidth(),(int) this.lightSource.getHeight(), false);
		tmpBuff.begin();
		Gdx.gl.glClearColor(0f, 0f, 0f, 0f);
		Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
		tmpBuff.end();
		FrameBuffer bgBuff = new FrameBuffer(Pixmap.Format.RGBA8888, (int) this.lightSource.getWidth(),(int) this.lightSource.getHeight(), false);
		bgBuff.begin();
		Gdx.gl.glClearColor(0f, 0f, 0f, 0f);
		Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
		bgBuff.end();

		this.lightSprite = new Sprite(tmpBuff.getColorBufferTexture());
		this.bgSprite = new Sprite(bgBuff.getColorBufferTexture());

		System.out.println(lightSource.setName(Integer.toString(getID())));
		return this;
	}
 
開發者ID:henryco,項目名稱:Escapy,代碼行數:24,代碼來源:AbsStdLight.java

示例2: renderBRDF

import com.badlogic.gdx.graphics.glutils.FrameBuffer; //導入方法依賴的package包/類
private Texture renderBRDF() {
    ShaderProgram brdfShader = new ShaderProgram(
            Gdx.files.internal("shaders/brdf_shader.vert"),
            Gdx.files.internal("shaders/brdf_shader.frag"));

    FrameBuffer frameBuffer = FrameBuffer.createFrameBuffer(Pixmap.Format.RGB888, (int) brdfWidth, (int) brdfHeight, true);

    brdfShader.begin();
    frameBuffer.begin();
    Gdx.gl.glViewport(0, 0, (int) brdfWidth, (int) brdfHeight);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT);
    quadMesh.render(brdfShader, GL20.GL_TRIANGLES);
    frameBuffer.end();
    brdfShader.end();
    brdfShader.dispose();

    return frameBuffer.getColorBufferTexture();
}
 
開發者ID:MovementSpeed,項目名稱:nhglib,代碼行數:19,代碼來源:LightProbe.java

示例3: setupEye

import com.badlogic.gdx.graphics.glutils.FrameBuffer; //導入方法依賴的package包/類
private void setupEye(Eye eye, int width, int height, boolean hasStencil) {
	FrameBuffer buffer = new FrameBuffer(Format.RGBA8888, width, height, true, hasStencil);
	TextureRegion region = new TextureRegion(buffer.getColorBufferTexture());
	region.flip(false, true);
	VRCamera camera = new VRCamera(this, eye);
	camera.near = 0.1f;
	camera.far = 1000f;
	perEyeData[eye.index] = new VRPerEyeData(buffer, region, camera);
}
 
開發者ID:justinmarentette11,項目名稱:Tower-Defense-Galaxy,代碼行數:10,代碼來源:VRContext.java

示例4: initMaskTexture

import com.badlogic.gdx.graphics.glutils.FrameBuffer; //導入方法依賴的package包/類
public LightMask initMaskTexture() {

		FrameBuffer tmp = new FrameBuffer(Pixmap.Format.RGBA8888, width, height, false);
		tmp.begin();
		Gdx.gl.glClearColor(this.color.r, this.color.g, this.color.b, 1f);
		Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
		tmp.end();
		maskTexture = tmp.getColorBufferTexture();
		return this;
	}
 
開發者ID:henryco,項目名稱:Escapy,代碼行數:11,代碼來源:LightMask.java

示例5: render

import com.badlogic.gdx.graphics.glutils.FrameBuffer; //導入方法依賴的package包/類
@Override
public void render (final FrameBuffer src, final FrameBuffer dest) {
	Texture texsrc = src.getColorBufferTexture();

	boolean blendingWasEnabled = PostProcessor.isStateEnabled(GL20.GL_BLEND);
	Gdx.gl.glDisable(GL20.GL_BLEND);

	pingPongBuffer.begin();
	{
		// threshold / high-pass filter
		// only areas with pixels >= threshold are blit to smaller fbo
		threshold.setInput(texsrc).setOutput(pingPongBuffer.getSourceBuffer()).render();

		// blur pass
		blur.render(pingPongBuffer);
	}
	pingPongBuffer.end();

	if (blending || blendingWasEnabled) {
		Gdx.gl.glEnable(GL20.GL_BLEND);
	}

	if (blending) {
		// TODO support for Gdx.gl.glBlendFuncSeparate(sfactor, dfactor, GL20.GL_ONE, GL20.GL_ONE );
		Gdx.gl.glBlendFunc(sfactor, dfactor);
	}

	restoreViewport(dest);

	// mix original scene and blurred threshold, modulate via
	// set(Base|Bloom)(Saturation|Intensity)
	combine.setOutput(dest).setInput(texsrc, pingPongBuffer.getResultTexture()).render();
}
 
開發者ID:Osaris31,項目名稱:exterminate,代碼行數:34,代碼來源:Bloom.java

示例6: getFBTexture

import com.badlogic.gdx.graphics.glutils.FrameBuffer; //導入方法依賴的package包/類
/** Gets requested framebuffer's texture.
 * 
 * @param fbIdn
 * @return */
public Texture getFBTexture (String fbIdn) {
	FrameBuffer fb = frameBuffers.get(fbIdn);
	if (fb != null)
		return fb.getColorBufferTexture();
	return null;
}
 
開發者ID:Quexten,項目名稱:RavTech,代碼行數:11,代碼來源:ShaderManager.java

示例7: createVirtualViewport

import com.badlogic.gdx.graphics.glutils.FrameBuffer; //導入方法依賴的package包/類
private ViewportData createVirtualViewport( View view ) {
    final Rectangle bounds = view.getBounds();
    final OrthographicCamera camera = new OrthographicCamera( bounds.width, bounds.height );
    final float fboScaler = view.getFboScaler();
    final FrameBuffer frameBuffer = new FrameBuffer( Format.RGBA8888, (int) ( bounds.width * fboScaler ), (int) ( bounds.height * fboScaler ), false ) ;
    final TextureRegion textureRegion = new TextureRegion( frameBuffer.getColorBufferTexture() );
    
    textureRegion.flip( false, false );
    return new ViewportData( camera, frameBuffer, textureRegion );
}
 
開發者ID:Inari-Soft,項目名稱:inari-firefly-libGDX,代碼行數:11,代碼來源:GdxGraphicsImpl.java

示例8: render

import com.badlogic.gdx.graphics.glutils.FrameBuffer; //導入方法依賴的package包/類
@Override
public void render(final FrameBuffer src, final FrameBuffer dest) {
   Texture texsrc = src.getColorBufferTexture();

   boolean blendingWasEnabled = PostProcessor.isStateEnabled(GL20.GL_BLEND);
   Gdx.gl.glDisable(GL20.GL_BLEND);

   pingPongBuffer.begin();
   {
      // threshold / high-pass filter
      // only areas with pixels >= threshold are blit to smaller fbo
      threshold.setInput(texsrc).setOutput(pingPongBuffer.getSourceBuffer()).render();

      // blur pass
      blur.render(pingPongBuffer);
   }
   pingPongBuffer.end();

   if (blending || blendingWasEnabled) {
      Gdx.gl.glEnable(GL20.GL_BLEND);
   }

   if (blending) {
      // TODO support for Gdx.gl.glBlendFuncSeparate(sfactor, dfactor, GL20.GL_ONE,
      // GL20.GL_ONE );
      Gdx.gl.glBlendFunc(sfactor, dfactor);
   }

   restoreViewport(dest);

   // mix original scene and blurred threshold, modulate via
   // set(Base|Bloom)(Saturation|Intensity)
   combine.setOutput(dest).setInput(texsrc, pingPongBuffer.getResultTexture()).render();
}
 
開發者ID:bitbrain,項目名稱:braingdx,代碼行數:35,代碼來源:Bloom.java

示例9: init

import com.badlogic.gdx.graphics.glutils.FrameBuffer; //導入方法依賴的package包/類
@Override
public void init() {
    super.init();
    fbo = new FrameBuffer(Pixmap.Format.RGBA4444, Gdx.graphics.getWidth(), Gdx.graphics.getHeight(), false);
    fboTex = fbo.getColorBufferTexture();
    Gdx.gl.glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    Gdx.gl.glEnable(GL_BLEND);
    SpriteBatch batch = new SpriteBatch();
    batch.setProjectionMatrix(RadixClient.getInstance().getHudCamera().combined);
    fbo.bind();
    batch.begin();
    currentScreen.render(false, batch);
    batch.end();
    FrameBuffer.unbind();
}
 
開發者ID:mstojcevich,項目名稱:Radix,代碼行數:16,代碼來源:SlideUpAnimation.java

示例10: create

import com.badlogic.gdx.graphics.glutils.FrameBuffer; //導入方法依賴的package包/類
public void create () {
	ShaderProgram.pedantic = false;
	/*
	 * shader = new ShaderProgram(Gdx.files.internal("data/shaders/default.vert").readString(), Gdx.files.internal(
	 * "data/shaders/depthtocolor.frag").readString()); if (!shader.isCompiled()) { Gdx.app.log("EdgeDetectionTest",
	 * "couldn't compile scene shader: " + shader.getLog()); }
	 */
	batchShader = new ShaderProgram(Gdx.files.internal("data/shaders/batch.vert").readString(), Gdx.files.internal(
		"data/shaders/convolution.frag").readString());
	if (!batchShader.isCompiled()) {
		Gdx.app.log("EdgeDetectionTest", "couldn't compile post-processing shader: " + batchShader.getLog());
	}

	ObjLoader objLoader = new ObjLoader();
	scene = objLoader.loadObj(Gdx.files.internal("data/scene.obj"));
	sceneInstance = new ModelInstance(scene);
	modelBatch = new ModelBatch();
	fbo = new FrameBuffer(Format.RGB565, Gdx.graphics.getWidth(), Gdx.graphics.getHeight(), true);
	cam = new PerspectiveCamera(67, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
	cam.position.set(0, 0, 10);
	cam.lookAt(0, 0, 0);
	cam.far = 30;
	batch = new SpriteBatch();
	batch.setShader(batchShader);
	fboRegion = new TextureRegion(fbo.getColorBufferTexture());
	fboRegion.flip(false, true);
	logger = new FPSLogger();
	calculateOffsets();
}
 
開發者ID:basherone,項目名稱:libgdxcn,代碼行數:30,代碼來源:EdgeDetectionTest.java

示例11: generateHouseRow

import com.badlogic.gdx.graphics.glutils.FrameBuffer; //導入方法依賴的package包/類
Sprite generateHouseRow(float y, int height) {
	// Bottom houses
	TextureGenerator houseTexGenerator = new HouseTextureGenerator();
	final int OFFSET = 70;
	final int MIN_HEIGHT = (int) (height);
	final int MAX_HEIGHT = (int) (MIN_HEIGHT + OFFSET);
	
	FrameBuffer buffer = new FrameBuffer(Format.RGBA4444, Gdx.graphics.getWidth(), MAX_HEIGHT, false);
	
	Matrix4 projectionMatrix = new Matrix4();
	projectionMatrix.setToOrtho2D(0, 0, buffer.getWidth(), buffer.getHeight());

	batch.setProjectionMatrix(projectionMatrix);
	
	buffer.begin();		
	batch.begin();
	
		int offsetX = (int) -(Math.random() * 250);
		
		while (offsetX < buffer.getWidth()) {
			Texture texture = houseTexGenerator.create((int)Math.round(150 + Math.random() * 50), (int)Math.round(MIN_HEIGHT + Math.random() * OFFSET));
			batch.draw(texture, offsetX, 0f);
			offsetX += texture.getWidth();
		}
		
	batch.end();
	batch.flush();		
	buffer.end();
	
	Sprite s = new Sprite(buffer.getColorBufferTexture());
	s.setY(y - OFFSET);
	return s;
}
 
開發者ID:bitbrain,項目名稱:pretender,代碼行數:34,代碼來源:IngameScreen.java

示例12: initialize

import com.badlogic.gdx.graphics.glutils.FrameBuffer; //導入方法依賴的package包/類
public void initialize(){
	int w = Gdx.graphics.getWidth();
	int h = Gdx.graphics.getHeight();
	nextFbo = new FrameBuffer(Format.RGB565, w, h, false);
	currFbo = new FrameBuffer(Format.RGB565, w, h, false);
	setUpNormalProjection();
	nexTex = new TextureRegion(nextFbo.getColorBufferTexture());
	currTex = new TextureRegion(currFbo.getColorBufferTexture());
	nexTex.flip(false, true);
	currTex.flip(false, true);
}
 
開發者ID:randombot,項目名稱:gametemplate,代碼行數:12,代碼來源:TransitionManager.java

示例13: resize

import com.badlogic.gdx.graphics.glutils.FrameBuffer; //導入方法依賴的package包/類
@Override
public void resize(int width, int height) {
	if (width != previousWidth && height != previousHeight) {
		positionUI();
		Viewport viewport = Env.game.getViewport();
		fbo = new FrameBuffer(Format.RGB888, viewport.getViewportWidth(),
				viewport.getViewportHeight(), false);
		fboRegion = new TextureRegion(fbo.getColorBufferTexture());
		fboRegion.flip(false, true);
		
		previousWidth = width;
		previousHeight = height;
	}
}
 
開發者ID:saltares,項目名稱:ludumdare-29,代碼行數:15,代碼來源:GameScreen.java

示例14: create

import com.badlogic.gdx.graphics.glutils.FrameBuffer; //導入方法依賴的package包/類
@Override
public void create() {
    grass = new Texture(Gdx.files.internal("shaders/shockwave/grass.png"));
    guy = new Texture(Gdx.files.internal("shaders/shockwave/guy.png"));

    ShaderProgram.pedantic = false;
    blurShader = new ShaderProgram(Gdx.files.internal("shaders/blur/gaussianVert.glsl").readString(), Gdx.files.internal("shaders/blur/gaussianFrag.glsl").readString());

    //ensure it compiled
    if (!blurShader.isCompiled())
        throw new GdxRuntimeException("Could not compile shader: "+blurShader.getLog());
    //print any warnings
    if (blurShader.getLog().length()!=0)
        System.out.println(blurShader.getLog());

    fbo = new FrameBuffer(Pixmap.Format.RGBA8888, Gdx.graphics.getWidth(), Gdx.graphics.getHeight(), true);
    fboTexRegion = new TextureRegion(fbo.getColorBufferTexture());
    fboTexRegion.flip(false, true);

    batch = new SpriteBatch(1000);

    cam = new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
    cam.setToOrtho(false);

    //handle mouse wheel
    Gdx.input.setInputProcessor(new InputAdapter() {

        public boolean touchDown (int screenX, int screenY, int pointer, int button) {
            //System.out.println("screenx: "+screenX);
            time = 0;
            mouseX = (float)screenX / (float)Gdx.graphics.getWidth();
            mouseY = 1.0f - (float)screenY / (float)Gdx.graphics.getHeight();
            return true;
        }
    });
}
 
開發者ID:sscholle,項目名稱:PlanePilot,代碼行數:37,代碼來源:MotionBlurDemo.java

示例15: create

import com.badlogic.gdx.graphics.glutils.FrameBuffer; //導入方法依賴的package包/類
@Override
public void create() {
    grass = new Texture(Gdx.files.internal("shaders/shockwave/grass.png"));
    guy = new Texture(Gdx.files.internal("shaders/shockwave/guy.png"));

    ShaderProgram.pedantic = false;
    blurShader = new ShaderProgram(Gdx.files.internal("shaders/blur/gaussianVert.glsl").readString(), Gdx.files.internal("shaders/blur/gaussianFrag.glsl").readString());
    shader = new ShaderProgram(Gdx.files.internal("shaders/shockwave/shockVert.glsl").readString(), Gdx.files.internal("shaders/shockwave/shockFrag.glsl").readString());
    //ensure it compiled
    if (!shader.isCompiled())
        throw new GdxRuntimeException("Could not compile shader: "+shader.getLog());
    //print any warnings
    if (shader.getLog().length()!=0)
        System.out.println(shader.getLog());

    fbo = new FrameBuffer(Pixmap.Format.RGBA8888, Gdx.graphics.getWidth(), Gdx.graphics.getHeight(), true);
    fboTexRegion = new TextureRegion(fbo.getColorBufferTexture());
    fboTexRegion.flip(false, true);

    batch = new SpriteBatch(1000);

    cam = new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
    cam.setToOrtho(false);

    //handle mouse wheel
    Gdx.input.setInputProcessor(new InputAdapter() {

        public boolean touchDown (int screenX, int screenY, int pointer, int button) {
            //System.out.println("screenx: "+screenX);
            time = 0;
            mouseX = (float)screenX / (float)Gdx.graphics.getWidth();
            mouseY = 1.0f - (float)screenY / (float)Gdx.graphics.getHeight();
            return true;
        }
    });
}
 
開發者ID:sscholle,項目名稱:PlanePilot,代碼行數:37,代碼來源:ShockwaveDemo.java


注:本文中的com.badlogic.gdx.graphics.glutils.FrameBuffer.getColorBufferTexture方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。