当前位置: 首页>>代码示例>>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;未经允许,请勿转载。