com.badlogic.gdx.graphics.glutils.FrameBuffer.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(7.9k)|赞(0)|评价(0)|浏览(143)

本文整理了Java中com.badlogic.gdx.graphics.glutils.FrameBuffer.<init>()方法的一些代码示例,展示了FrameBuffer.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FrameBuffer.<init>()方法的具体详情如下:
包路径:com.badlogic.gdx.graphics.glutils.FrameBuffer
类名称:FrameBuffer
方法名:<init>

FrameBuffer.<init>介绍

[英]Creates a new FrameBuffer having the given dimensions and potentially a depth buffer attached.
[中]创建具有给定维度的新帧缓冲区,并可能附加深度缓冲区。

代码示例

代码示例来源:origin: libgdx/libgdx

@Override
  public FrameBuffer build () {
    return new FrameBuffer(this);
  }
}

代码示例来源:origin: libgdx/libgdx

@Override
  public FrameBuffer build () {
    return new FrameBuffer(this);
  }
}

代码示例来源:origin: libgdx/libgdx

/** @deprecated Experimental, likely to change, do not use! */
public DirectionalShadowLight (int shadowMapWidth, int shadowMapHeight, float shadowViewportWidth, float shadowViewportHeight,
  float shadowNear, float shadowFar) {
  fbo = new FrameBuffer(Format.RGBA8888, shadowMapWidth, shadowMapHeight, true);
  cam = new OrthographicCamera(shadowViewportWidth, shadowViewportHeight);
  cam.near = shadowNear;
  cam.far = shadowFar;
  halfHeight = shadowViewportHeight * 0.5f;
  halfDepth = shadowNear + 0.5f * (shadowFar - shadowNear);
  textureDesc = new TextureDescriptor();
  textureDesc.minFilter = textureDesc.magFilter = Texture.TextureFilter.Nearest;
  textureDesc.uWrap = textureDesc.vWrap = Texture.TextureWrap.ClampToEdge;
}

代码示例来源:origin: libgdx/libgdx

/** @deprecated Experimental, likely to change, do not use! */
public DirectionalShadowLight (int shadowMapWidth, int shadowMapHeight, float shadowViewportWidth, float shadowViewportHeight,
  float shadowNear, float shadowFar) {
  fbo = new FrameBuffer(Format.RGBA8888, shadowMapWidth, shadowMapHeight, true);
  cam = new OrthographicCamera(shadowViewportWidth, shadowViewportHeight);
  cam.near = shadowNear;
  cam.far = shadowFar;
  halfHeight = shadowViewportHeight * 0.5f;
  halfDepth = shadowNear + 0.5f * (shadowFar - shadowNear);
  textureDesc = new TextureDescriptor();
  textureDesc.minFilter = textureDesc.magFilter = Texture.TextureFilter.Nearest;
  textureDesc.uWrap = textureDesc.vWrap = Texture.TextureWrap.ClampToEdge;
}

代码示例来源:origin: libgdx/libgdx

protected void init1 () {
  frameBuffers[FIRST_PASS] = new FrameBuffer(Pixmap.Format.RGBA8888, allocator.getWidth(), allocator.getHeight(), true);
}

代码示例来源:origin: libgdx/libgdx

protected void init2 () {
  frameBuffers[SECOND_PASS] = new FrameBuffer(Pixmap.Format.RGBA8888, Gdx.graphics.getBackBufferWidth(), Gdx.graphics.getBackBufferHeight(), true);
  passShaderProviders[SECOND_PASS] = new Pass2ShaderProvider(new Pass2Shader.Config(this));
}

代码示例来源:origin: libgdx/libgdx

@Override
public void create () {
  mesh = new Mesh(true, 3, 0, new VertexAttribute(Usage.Position, 3, "a_Position"), new VertexAttribute(Usage.ColorPacked, 4,
    "a_Color"), new VertexAttribute(Usage.TextureCoordinates, 2, "a_texCoords"));
  float c1 = Color.toFloatBits(255, 0, 0, 255);
  float c2 = Color.toFloatBits(255, 0, 0, 255);
  float c3 = Color.toFloatBits(0, 0, 255, 255);
  mesh.setVertices(new float[] {-0.5f, -0.5f, 0, c1, 0, 0, 0.5f, -0.5f, 0, c2, 1, 0, 0, 0.5f, 0, c3, 0.5f, 1});
  stencilMesh = new Mesh(true, 3, 0, new VertexAttribute(Usage.Position, 3, "a_Position"), new VertexAttribute(
    Usage.ColorPacked, 4, "a_Color"), new VertexAttribute(Usage.TextureCoordinates, 2, "a_texCoords"));
  stencilMesh.setVertices(new float[] {-0.5f, 0.5f, 0, c1, 0, 0, 0.5f, 0.5f, 0, c2, 1, 0, 0, -0.5f, 0, c3, 0.5f, 1});
  texture = new Texture(Gdx.files.internal("data/badlogic.jpg"));
  spriteBatch = new SpriteBatch();
  frameBuffer = new FrameBuffer(Format.RGB565, 128, 128, false);
  stencilFrameBuffer = new FrameBuffer(Format.RGB565, 128, 128, true, true);
  createShader(Gdx.graphics);
}

代码示例来源:origin: libgdx/libgdx

@Override
public void create () {
  fb = new FrameBuffer(Format.RGBA8888, 200, 100, false);
  ffb = new FloatFrameBuffer(200, 100, false);

代码示例来源:origin: libgdx/libgdx

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.loadModel(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();
}

代码示例来源:origin: com.badlogicgames.gdx/gdx

@Override
  public FrameBuffer build () {
    return new FrameBuffer(this);
  }
}

代码示例来源:origin: stackoverflow.com

fbo = new FrameBuffer();
fbo.begin();
// draw your stuff
// ...
fbo.end();

代码示例来源:origin: manuelbua/libgdx-contribs

/** Creates a new ping-pong buffer and owns the resources. */
public PingPongBuffer (int width, int height, Format frameBufferFormat, boolean hasDepth) {
  ownResources = true;
  owned1 = new FrameBuffer(frameBufferFormat, width, height, hasDepth);
  owned2 = new FrameBuffer(frameBufferFormat, width, height, hasDepth);
  set(owned1, owned2);
}

代码示例来源:origin: dingjibang/GDX-RPG

/** Creates a new ping-pong buffer and owns the resources. */
public PingPongBuffer (int width, int height, Format frameBufferFormat, boolean hasDepth) {
  ownResources = true;
  owned1 = new FrameBuffer(frameBufferFormat, width, height, hasDepth);
  owned2 = new FrameBuffer(frameBufferFormat, width, height, hasDepth);
  set(owned1, owned2);
}

代码示例来源:origin: manuelbua/uracer-kotd

/** Creates a new ping-pong buffer and owns the resources. */
public PingPongBuffer (int width, int height, Format frameBufferFormat, boolean hasDepth) {
  ownResources = true;
  owned1 = new FrameBuffer(frameBufferFormat, width, height, hasDepth);
  owned2 = new FrameBuffer(frameBufferFormat, width, height, hasDepth);
  set(owned1, owned2);
}

代码示例来源:origin: langurmonkey/gaiasky

private FrameBuffer getFrameBuffer(int w, int h, int extra) {
  int key = getKey(w, h, extra);
  if (!fbcm.containsKey(key)) {
    fbcm.put(key, new FrameBuffer(Format.RGB888, w, h, true));
  }
  return fbcm.get(key);
}

代码示例来源:origin: langurmonkey/gaiasky

public FrameBuffer getFrameBuffer(int w, int h) {
  String key = getKey(w, h);
  if (!fbmap.containsKey(key)) {
    FrameBuffer fb = new FrameBuffer(Format.RGB888, w, h, true);
    fbmap.put(key, fb);
  }
  return fbmap.get(key);
}

代码示例来源:origin: com.badlogicgames.gdx/gdx

/** @deprecated Experimental, likely to change, do not use! */
public DirectionalShadowLight (int shadowMapWidth, int shadowMapHeight, float shadowViewportWidth, float shadowViewportHeight,
  float shadowNear, float shadowFar) {
  fbo = new FrameBuffer(Format.RGBA8888, shadowMapWidth, shadowMapHeight, true);
  cam = new OrthographicCamera(shadowViewportWidth, shadowViewportHeight);
  cam.near = shadowNear;
  cam.far = shadowFar;
  halfHeight = shadowViewportHeight * 0.5f;
  halfDepth = shadowNear + 0.5f * (shadowFar - shadowNear);
  textureDesc = new TextureDescriptor();
  textureDesc.minFilter = textureDesc.magFilter = Texture.TextureFilter.Nearest;
  textureDesc.uWrap = textureDesc.vWrap = Texture.TextureWrap.ClampToEdge;
}

代码示例来源:origin: jmrapp1/SpaceInvaders

public void resize(int width, int height) {
  fbo = new FrameBuffer(Format.RGBA8888, width, height, false);
  finalShader.begin();
  finalShader.setUniformf("resolution", width, height);
  finalShader.end();
}

代码示例来源:origin: mstojcevich/Radix

@Override
public void init() {
  render = new FrameBuffer(Pixmap.Format.RGBA8888, Gdx.graphics.getWidth(), Gdx.graphics.getHeight(), false);
  renderTexture = render.getColorBufferTexture();
}

代码示例来源:origin: LonamiWebs/Klooni1010

@Override
public void resize(int width, int height) {
  this.width = width;
  this.height = height;
  if (frameBuffer != null)
    frameBuffer.dispose();
  frameBuffer = new FrameBuffer(Pixmap.Format.RGB565, width, height, false);
  bufferTexture = new TextureRegion(frameBuffer.getColorBufferTexture());
  bufferTexture.flip(false, true);
}

相关文章