本文整理匯總了Java中com.badlogic.gdx.graphics.glutils.FrameBuffer.end方法的典型用法代碼示例。如果您正苦於以下問題:Java FrameBuffer.end方法的具體用法?Java FrameBuffer.end怎麽用?Java FrameBuffer.end使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.badlogic.gdx.graphics.glutils.FrameBuffer
的用法示例。
在下文中一共展示了FrameBuffer.end方法的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();
}
示例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;
}
示例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();
}
示例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;
}
示例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();
}
}
}
示例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();
}
示例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();
}
示例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;
}
示例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();
}
示例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();
}
示例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;
}
示例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();
}
}
示例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;
}
示例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;
}
示例15: endFrameBuffer
import com.badlogic.gdx.graphics.glutils.FrameBuffer; //導入方法依賴的package包/類
/**
* Stops rendering to the current FrameBuffer
*/
public void endFrameBuffer() {
if (activeFrameBuffers.empty()) {
throw new GdxRuntimeException("There is no active frame buffer that can be ended");
}
final FrameBuffer frameBuffer = activeFrameBuffers.pop();
frameBuffer.end();
}