本文整理汇总了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();
}
示例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: 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);
}