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


Java FrameBuffer.begin方法代碼示例

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


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

示例1: initialize

import com.badlogic.gdx.graphics.glutils.FrameBuffer; //導入方法依賴的package包/類
@Override
protected void initialize() {
    batch = new SpriteBatch(4000);
    new ShapeRenderer();

    planetPixel = new TextureRegion(new Texture("planetcell.png"), 1, 1);

    dirtyMask = new int[SIMULATION_WIDTH * SIMULATION_HEIGHT];

    frameBuffer = new FrameBuffer(Pixmap.Format.RGBA8888, SIMULATION_WIDTH, SIMULATION_HEIGHT, false);
    frameBuffer.getColorBufferTexture().setFilter(Texture.TextureFilter.Nearest, Texture.TextureFilter.Nearest);
    frameBuffer.begin();
    Gdx.gl.glClearColor(0f, 0f, 0f, 1f);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
    frameBuffer.end();

    vboCamera = new OrthographicCamera(SIMULATION_WIDTH, SIMULATION_HEIGHT);
    vboCamera.setToOrtho(true, SIMULATION_WIDTH, SIMULATION_HEIGHT);
    vboCamera.update();
}
 
開發者ID:DaanVanYperen,項目名稱:odb-little-fortune-planet,代碼行數:21,代碼來源:PlanetRenderSystem.java

示例2: 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

示例3: 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

示例4: applyPasses

import com.badlogic.gdx.graphics.glutils.FrameBuffer; //導入方法依賴的package包/類
public FrameBuffer applyPasses (SpriteBatch batch, FrameBuffer inputBuffer, FrameBuffer outputBuffer) {
	batch.begin();
	batch.setProjectionMatrix(matrix);
	FrameBuffer iBuffer = inputBuffer;
	FrameBuffer oBuffer = outputBuffer;
	for (int i = 0; i < passes.size; i++) {
		oBuffer.begin();
		Gdx.gl.glClearColor(0, 0, 0, 1);
		Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
		batch.setShader(RavTech.sceneHandler.shaderManager.get(passes.get(i)));
		batch.draw(iBuffer.getColorBufferTexture(), 0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
		batch.setShader(RavTech.sceneHandler.shaderManager.get("default"));
		oBuffer.end();
		FrameBuffer tempBuffer = oBuffer;
		oBuffer = iBuffer;
		iBuffer = tempBuffer;
	}
	batch.end();
	return oBuffer;
}
 
開發者ID:Quexten,項目名稱:RavTech,代碼行數:21,代碼來源:PostProcessingEffect.java

示例5: render

import com.badlogic.gdx.graphics.glutils.FrameBuffer; //導入方法依賴的package包/類
public void render(Batch batch, float delta, FrameBuffer buffer) {
   if (isEnabled()) {
      if (shaderManager.hasEffects()) {
         shaderManager.begin();
         this.batch.setProjectionMatrix(camera.combined);
         this.batch.begin();
         this.batch.draw(buffer.getColorBufferTexture(), 0f, 0f);
         this.batch.end();
         layer.render(batch, delta);
         shaderManager.end(buffer);
      } else {
         buffer.begin();
         layer.render(batch, delta);
         buffer.end();
      }
   }
}
 
開發者ID:bitbrain,項目名稱:braingdx,代碼行數:18,代碼來源:CombinedRenderPipe.java

示例6: renderDecalsForBufferAndBatch

import com.badlogic.gdx.graphics.glutils.FrameBuffer; //導入方法依賴的package包/類
public void renderDecalsForBufferAndBatch(FrameBuffer buffer, DecalBatch batch) {
  buffer.begin();
    renderContext.begin();
    renderContext.end();
    renderContext.begin();

      Gdx.gl.glClearColor(0, 0, 0, 1);
      Gdx.gl.glViewport(0, 0, buffer.getWidth(), buffer.getHeight());
      Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT  | GL20.GL_DEPTH_BUFFER_BIT);

      for (Entity entity : entities) {
        if (EntityDecalRenderable.class.isInstance(entity)) {
          EntityDecalRenderable en = (EntityDecalRenderable)entity;
          en.renderBatch(batch, environment);
        }
      }

      batch.flush();
    renderContext.end();
  buffer.end();
}
 
開發者ID:macbury,項目名稱:BotLogic,代碼行數:22,代碼來源:GameLevelScreen.java

示例7: twoPassBlur

import com.badlogic.gdx.graphics.glutils.FrameBuffer; //導入方法依賴的package包/類
/**
 * gaussian blur on the entire screen
 * 
 * @param batch
 * @param buffer
 * @param blurshader
 * @param radius
 *            amount in pixels to blur
 */
public static void twoPassBlur(Batch batch, FrameBuffer buffer, ShaderProgram blurshader,
		float radius, float x, float y, float drawWidth, float drawHeight, int u, int v,
		int width, int height) {
	buffer.begin();
	batch.setShader(blurshader);
	blurshader.setUniformf("radius", (float) radius);
	blurshader.setUniformf("dir", 1f, 0f);
	batch.draw(buffer.getColorBufferTexture(), x, y, drawWidth, drawHeight, u, v, width,
			height, false, true);
	batch.flush();
	buffer.end();

	buffer.begin();
	blurshader.setUniformf("dir", 0f, 1f);
	batch.draw(buffer.getColorBufferTexture(), x, y, drawWidth, drawHeight, u, v, width,
			height, false, true);
	batch.setShader(null);
	buffer.end();

	batch.draw(buffer.getColorBufferTexture(), 0, Gdx.graphics.getHeight(), buffer.getWidth(),
			-buffer.getHeight());
	batch.flush();
}
 
開發者ID:chrislo27,項目名稱:Stray-core,代碼行數:33,代碼來源:PostProcessing.java

示例8: drawActor

import com.badlogic.gdx.graphics.glutils.FrameBuffer; //導入方法依賴的package包/類
private FrameBuffer drawActor(Actor actor) {
	root.addActor(actor);

	int width = (int) (Gdx.graphics.getHeight() - Gdx.graphics.getDensity() * 56);
	int height = (int) (Gdx.graphics.getHeight() / 2.15f);

	FrameBuffer frameBuffer = new FrameBuffer(Format.RGB888, width, height,
			false);
	frameBuffer.begin();

	Gdx.gl.glClearColor(1f, 1f, 1f, 1f);
	Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
	batch.begin();
	root.draw(batch, 1.0f);
	batch.end();
	frameBuffer.end();
	batch.setColor(Color.WHITE);
	return frameBuffer;
}
 
開發者ID:e-ucm,項目名稱:ead,代碼行數:20,代碼來源:CreateSceneThumbnail.java

示例9: drawToBuffer

import com.badlogic.gdx.graphics.glutils.FrameBuffer; //導入方法依賴的package包/類
/**
 * Draws the given gradient {@link Texture} to the given {@link FrameBuffer}, using the given {@link Color} with the given percent.
 * <p>
 * This is achieved via a gradient shader.
 *
 * @param buffer     the {@link FrameBuffer} to be drawn to
 * @param color      the {@link Color} which should be drawn
 * @param gradient   the gradient texture which should be drawn
 * @param perc       the percent the gradient texture should be drawn
 * @param projection projection matrix for pixel perfect rendering
 */
private void drawToBuffer(FrameBuffer buffer, Color color, TextureRegion gradient, float perc, Matrix4 projection) {
    buffer.begin();
    AL.graphics.getGL20().glClearColor(0, 0, 0, 0);
    AL.graphics.getGL20().glClear(GL20.GL_COLOR_BUFFER_BIT);

    shaderBatch.setProjectionMatrix(projection);
    shaderBatch.begin();
    shaderBatch.setColor(color);
    shader.setUniformf("u_gradient", perc);
    shaderBatch.draw(gradient, -buffer.getWidth() / 2, -buffer.getHeight() / 2);
    shaderBatch.end();
    buffer.end();
}
 
開發者ID:EtherWorks,項目名稱:arcadelegends-gg,代碼行數:25,代碼來源:PlayerHelper.java

示例10: drawToBuffer

import com.badlogic.gdx.graphics.glutils.FrameBuffer; //導入方法依賴的package包/類
/**
 * Draws the given gradient {@link Texture} to the given {@link FrameBuffer}, using the given {@link Color} with the given percent.
 * <p>
 * This is achieved via a gradient shader.
 *
 * @param buffer      the {@link FrameBuffer} to be drawn to
 * @param color       the {@link Color} which should be drawn
 * @param gradient    the gradient texture which should be drawn
 * @param perc        the percent the gradient texture should be drawn
 * @param shaderBatch the {@link SpriteBatch} to use
 * @param shader      the {@link ShaderProgram} to use
 * @param projection  projection matrix for pixel perfect rendering
 */
private static void drawToBuffer(FrameBuffer buffer, Color color, Texture gradient, float perc, SpriteBatch shaderBatch, ShaderProgram shader, Matrix4 projection) {
    buffer.begin();
    AL.graphics.getGL20().glClearColor(0, 0, 0, 0);
    AL.graphics.getGL20().glClear(GL20.GL_COLOR_BUFFER_BIT);

    shaderBatch.setProjectionMatrix(projection);
    shaderBatch.begin();
    shaderBatch.setColor(color);
    shader.setUniformf("u_gradient", perc);
    shaderBatch.draw(gradient, -buffer.getWidth() / 2, -buffer.getHeight() / 2);
    shaderBatch.end();
    buffer.end();
}
 
開發者ID:EtherWorks,項目名稱:arcadelegends-gg,代碼行數:27,代碼來源:CharacterRenderer.java

示例11: getMapScreenShot

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

    float oldCameraZoom = getCamera().zoom;
    float oldCameraX = getCamera().position.x;
    float oldCameraY = getCamera().position.y;

    MapUtils.adjustCamera(getCamera(), grid);

    final FrameBuffer fbo = new FrameBuffer(Pixmap.Format.RGBA8888, WIDTH, HEIGHT, false);

    fbo.begin();
    batch.setProjectionMatrix(getCamera().combined);
    batch.begin();

    for(int i = 0; i < grid.getHexs().length; i++)
    {
        drawHexagon(grid.getHexs()[i], batch);
    }

    batch.end();
    Pixmap pixmap = ScreenUtils.getFrameBufferPixmap(0, 0, WIDTH, HEIGHT);
    fbo.end();

    //fbo.dispose();

    getCamera().zoom = oldCameraZoom;
    getCamera().position.x = oldCameraX;
    getCamera().position.y = oldCameraY;

    return pixmap;
}
 
開發者ID:MartensCedric,項目名稱:Hexpert,代碼行數:33,代碼來源:PlayScreen.java

示例12: render

import com.badlogic.gdx.graphics.glutils.FrameBuffer; //導入方法依賴的package包/類
@Override
public void render(Texture source, FrameBuffer destination) {
	if (destination == null) {
		actualRender(source);
	} else {
		destination.begin();
		actualRender(source);
		destination.end();
	}
}
 
開發者ID:spookygames,項目名稱:gdx-gfx,代碼行數:11,代碼來源:ShaderEffect.java

示例13: 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

示例14: renderOutBuffer

import com.badlogic.gdx.graphics.glutils.FrameBuffer; //導入方法依賴的package包/類
/**Render data from contained {@link FrameBuffer} into target buffer,
 * <br>this method uses for this {@link FBORenderProgram}.
 * @param buffer - target {@link FrameBuffer} to render for.
 * @param ePP - optional {@link EscapyPostProcessed} data for render.
 * @param cam - {@link EscapyGdxCamera} cannot be null.
 * @return buffer - {@link FrameBuffer} with rendered data.
 * @see {@link FBORenderProgram#renderProgram(EscapyGdxCamera, EscapyPostProcessed)} */
public FrameBuffer renderOutBuffer(FrameBuffer buffer, EscapyPostProcessed ePP, 
		EscapyGdxCamera cam) {	
	buffer.begin();
		this.renderProgram.renderProgram(cam, ePP);
	buffer.end();
	return buffer;
}
 
開發者ID:henryco,項目名稱:Escapy,代碼行數:15,代碼來源:EscapyFBO.java

示例15: beginFB

import com.badlogic.gdx.graphics.glutils.FrameBuffer; //導入方法依賴的package包/類
/** Call this to start rendering to given framebuffer.
 * 
 * @param fb - framebuffer to render to
 * @param clearColor - clear color for this framebuffer */
private void beginFB (FrameBuffer fb, Color clearColor) {
	if (fb == null)
		throw new IllegalArgumentException("FrameBuffer must not be null!");
	fb.begin();
	Gdx.graphics.getGL20().glViewport(0, 0, fb.getWidth(), fb.getHeight());
	Gdx.graphics.getGL20().glClearColor(clearColor.r, clearColor.g, clearColor.b, clearColor.a);
	Gdx.graphics.getGL20().glClear(GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT);
	Gdx.graphics.getGL20().glEnable(GL20.GL_TEXTURE_2D);
	Gdx.graphics.getGL20().glEnable(GL20.GL_BLEND);
	Gdx.graphics.getGL20().glBlendFunc(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);
}
 
開發者ID:Quexten,項目名稱:RavTech,代碼行數:16,代碼來源:ShaderManager.java


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