当前位置: 首页>>代码示例>>Java>>正文


Java ShaderProgram.end方法代码示例

本文整理汇总了Java中com.badlogic.gdx.graphics.glutils.ShaderProgram.end方法的典型用法代码示例。如果您正苦于以下问题:Java ShaderProgram.end方法的具体用法?Java ShaderProgram.end怎么用?Java ShaderProgram.end使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.badlogic.gdx.graphics.glutils.ShaderProgram的用法示例。


在下文中一共展示了ShaderProgram.end方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initShader

import com.badlogic.gdx.graphics.glutils.ShaderProgram; //导入方法依赖的package包/类
private ShaderProgram initShader(Texture colorMapTex, Texture maskMapTex, Texture normalMapTex, TransVec dim,
		float amIntensity, float dirIntensity, float shadIntensity, float sprtSize, float lum, float thresh, ShaderProgram shader) {
	shader.begin();
	{
		maskMapTex.bind(2);
		normalMapTex.bind(1);
		colorMapTex.bind(0);
		super.batcher.setShader(shader);

		shader.setUniformi(maskMap, 2);
		shader.setUniformi(normalMap, 1);
		shader.setUniformi(colorMap, 0);

		shader.setUniformf(fieldSize, dim.x, dim.y);
		shader.setUniformf(ambientIntensity, amIntensity);
		shader.setUniformf(directIntensity, dirIntensity);
		shader.setUniformf(shadowIntensity, shadIntensity);
		shader.setUniformf(spriteSize, sprtSize);
		shader.setUniformf(height, lum);
		shader.setUniformf(threshold, thresh);
	}
	shader.end();
	return shader;
}
 
开发者ID:henryco,项目名称:Escapy,代码行数:25,代码来源:EscapyVolumeRenderer.java

示例2: initShader

import com.badlogic.gdx.graphics.glutils.ShaderProgram; //导入方法依赖的package包/类
protected ShaderProgram initShader(Texture lMap, ShaderProgram shader, 
		Color color, TransVec angles, TransVec fSize, float coeff, 
		float correction, TransVec radius, TransVec umbra) {
	shader.begin();
	{
		lMap.bind(0);
		super.batcher.setShader(shader);
		
		shader.setUniformi(LIGHTMAP, 0);
		shader.setUniformf("u_color", color.r, color.g, color.b);
		shader.setUniformf("u_angles", angles.x, angles.y);
		shader.setUniformf("u_fieldSize", fSize.x, fSize.y);
		shader.setUniformf("u_coeff", coeff);
		shader.setUniformf("u_angCorrect", correction);
		shader.setUniformf("u_radius", radius.x, radius.y);
		shader.setUniformf("u_umbra", umbra.x, umbra.y);
	}
	shader.end();
	return shader;
}
 
开发者ID:henryco,项目名称:Escapy,代码行数:21,代码来源:EscapyLightSrcRenderer.java

示例3: renderIrradiance

import com.badlogic.gdx.graphics.glutils.ShaderProgram; //导入方法依赖的package包/类
private Cubemap renderIrradiance(Cubemap environmentCubemap) {
    ShaderProgram irradianceShader = new ShaderProgram(
            Gdx.files.internal("shaders/equi_to_cube_shader.vert"),
            Gdx.files.internal("shaders/irradiance_shader.frag"));

    FrameBufferCubemap frameBufferCubemap = FrameBufferCubemap.createFrameBufferCubemap(Pixmap.Format.RGB888,
            (int) irradianceWidth, (int) irradianceHeight, true);

    environmentCubemap.bind(0);
    irradianceShader.begin();
    irradianceShader.setUniformMatrix("u_projection", perspectiveCameras.first().projection);
    irradianceShader.setUniformi("u_environmentMap", 0);
    frameBufferCubemap.begin();
    for (int i = 0; i < 6; i++) {
        irradianceShader.setUniformMatrix("u_view", perspectiveCameras.get(i).view);
        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT);
        cubeMesh.render(irradianceShader, GL20.GL_TRIANGLES);
        frameBufferCubemap.nextSide();
    }
    frameBufferCubemap.end();
    irradianceShader.end();
    irradianceShader.dispose();

    return frameBufferCubemap.getColorBufferTexture();
}
 
开发者ID:MovementSpeed,项目名称:nhglib,代码行数:26,代码来源:LightProbe.java

示例4: renderBRDF

import com.badlogic.gdx.graphics.glutils.ShaderProgram; //导入方法依赖的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

示例5: run

import com.badlogic.gdx.graphics.glutils.ShaderProgram; //导入方法依赖的package包/类
@Override
public void run (ShaderProgram program) {
	int texId = sm.getCurrentTextureId();
	fbo.begin();
	program.begin();
	fbo2.getColorBufferTexture().bind(texId);
	program.setUniformi("u_texture", sm.getCurrentTextureId());
	program.setUniformf("u_viewport", width, height);
	addUniforms(program);
	quad.render(program, GL20.GL_TRIANGLES);
	if (saveBytes)
		data = getFrameBufferPixels(0, 0, width, height, false, data);
	program.end();
	fbo.end();
	swapBuffers();
}
 
开发者ID:Quexten,项目名称:RavTech,代码行数:17,代码来源:BufferedProcessor.java

示例6: setShader

import com.badlogic.gdx.graphics.glutils.ShaderProgram; //导入方法依赖的package包/类
public void setShader (ShaderProgram shader) {
    if (drawing) {
        flush();
        shader.end();
    }
    this.shader = shader;
    if (drawing) {
        shader.begin();
        applyMatrices();
    }
}
 
开发者ID:CypherCove,项目名称:gdx-cclibs,代码行数:12,代码来源:FlexBatch.java

示例7: ShaderBatch

import com.badlogic.gdx.graphics.glutils.ShaderProgram; //导入方法依赖的package包/类
public ShaderBatch(float brightness, float contrast)
{
	ShaderProgram.pedantic = false;
	ShaderProgram shader = new ShaderProgram(vertexShader, fragmentShader);
	setShader(shader);
	shader.begin();
	int brightnessLoc = shader.getUniformLocation("brightness");
	int contrastLoc = shader.getUniformLocation("contrast");
	shader.setUniformf(brightnessLoc, brightness);
	shader.setUniformf(contrastLoc, contrast);
	shader.end();
}
 
开发者ID:MMORPG-Prototype,项目名称:MMORPG_Prototype,代码行数:13,代码来源:ShaderBatch.java

示例8: initShader

import com.badlogic.gdx.graphics.glutils.ShaderProgram; //导入方法依赖的package包/类
protected ShaderProgram initShader(Texture srcMap, ShaderProgram program, 
		float widht, float height, float dirX, float dirY) {
	
	program.begin();
	{
		srcMap.bind(0);
		super.batcher.setShader(program);
		program.setUniformi(SOURCEMAP, 0);
		program.setUniformf("u_fieldSize", widht, height);
		program.setUniformf("u_direction", dirX, dirY);
	}	program.end();
	return program;
}
 
开发者ID:henryco,项目名称:Escapy,代码行数:14,代码来源:EscapyBlurRenderer.java

示例9: initShader

import com.badlogic.gdx.graphics.glutils.ShaderProgram; //导入方法依赖的package包/类
protected ShaderProgram initShader(Texture sourceMap, float lwidht, float lheight,
		TransVec angles, float correct, ShaderProgram shader) {
	
	shader.begin();
	{
		sourceMap.bind(0);
		super.batcher.setShader(shader);
		shader.setUniformi(SOURCEMAP, 0);
		shader.setUniformf("resolution", lwidht, lheight);
		shader.setUniformf("u_angles", angles.x, angles.y);
		shader.setUniformf("u_angCorrect", correct);
	}	shader.end();
	return shader;
}
 
开发者ID:henryco,项目名称:Escapy,代码行数:15,代码来源:EscapyShadowMapRenderer.java

示例10: initShader

import com.badlogic.gdx.graphics.glutils.ShaderProgram; //导入方法依赖的package包/类
protected ShaderProgram initShader(Texture sourceMap, float lwidht, float lheight,
		float threshold, TransVec angles, float correct, ShaderProgram shader) {

	shader.begin();
	{
		sourceMap.bind(0);
		super.batcher.setShader(shader);
		shader.setUniformi(SOURCEMAP, 0);
		shader.setUniformf("resolution", lwidht, lheight);
        shader.setUniformf("u_THRESHOLD", threshold);
	}	shader.end();
	return shader;
}
 
开发者ID:henryco,项目名称:Escapy,代码行数:14,代码来源:EscapyStdShadowMapRenderer.java

示例11: initShader

import com.badlogic.gdx.graphics.glutils.ShaderProgram; //导入方法依赖的package包/类
private ShaderProgram initShader(Texture target, Texture blend, ShaderProgram shader) {
	shader.begin();
	{
		blend.bind(1);
		target.bind(0);
		super.batcher.setShader(shader);
		shader.setUniformi(this.blendMap, 1);
		shader.setUniformi(this.targetMap, 0);
		super.shaderLoader.accept(shader);
	}
	shader.end();
	return shader;
}
 
开发者ID:henryco,项目名称:Escapy,代码行数:14,代码来源:EscapyBlendRenderer.java

示例12: render

import com.badlogic.gdx.graphics.glutils.ShaderProgram; //导入方法依赖的package包/类
public void render() {

		boolean needed = rayHandler.lightRenderedLastFrame > 0;


		if (lightMapDrawingDisabled)
			return;
		frameBuffer.getColorBufferTexture().bind(0);

		// at last lights are rendered over scene
		if (rayHandler.shadows) {
			final Color c = rayHandler.ambientLight;
			ShaderProgram shader = shadowShader;
			if (RayHandler.isDiffuse) {
				shader = diffuseShader;
				shader.begin();
				rayHandler.diffuseBlendFunc.apply();
				shader.setUniformf("ambient", c.r, c.g, c.b, c.a);
			} else {
				shader.begin();
				rayHandler.shadowBlendFunc.apply();
				shader.setUniformf("ambient", c.r * c.a, c.g * c.a,
						c.b * c.a, 1f - c.a);
			}
		//	shader.setUniformi("u_texture", 0);
			lightMapMesh.render(shader, GL20.GL_TRIANGLE_FAN);
			shader.end();
		} else if (needed) {
			rayHandler.simpleBlendFunc.apply();
			withoutShadowShader.begin();
		//	withoutShadowShader.setUniformi("u_texture", 0);
			lightMapMesh.render(withoutShadowShader, GL20.GL_TRIANGLE_FAN);
			withoutShadowShader.end();
		}

		Gdx.gl20.glDisable(GL20.GL_BLEND);
	}
 
开发者ID:bitbrain,项目名称:rbcgj-2016,代码行数:38,代码来源:LightMap.java

示例13: renderEnvironmentFromHDRData

import com.badlogic.gdx.graphics.glutils.ShaderProgram; //导入方法依赖的package包/类
private Cubemap renderEnvironmentFromHDRData(HDRData2 data) {
    Texture equirectangularTexture;
    ShaderProgram equiToCubeShader = new ShaderProgram(
            Gdx.files.internal("shaders/equi_to_cube_shader.vert"),
            Gdx.files.internal("shaders/equi_to_cube_shader.frag"));

    equirectangularTexture = data.getTexture();

    GLFrameBuffer.FrameBufferCubemapBuilder builder = new GLFrameBuffer.FrameBufferCubemapBuilder(
            (int) environmentWidth, (int) environmentHeight);
    builder.addColorTextureAttachment(GL30.GL_RGB8, GL30.GL_RGB, GL30.GL_UNSIGNED_BYTE);
    builder.addDepthRenderBufferAttachment();
    FrameBufferCubemap frameBufferCubemap = builder.build();

    equirectangularTexture.bind(0);
    equiToCubeShader.begin();
    equiToCubeShader.setUniformMatrix("u_projection", perspectiveCameras.first().projection);
    equiToCubeShader.setUniformi("u_equirectangularMap", 0);
    frameBufferCubemap.begin();
    for (int i = 0; i < 6; i++) {
        equiToCubeShader.setUniformMatrix("u_view", perspectiveCameras.get(i).view);
        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT);
        cubeMesh.render(equiToCubeShader, GL20.GL_TRIANGLES);
        frameBufferCubemap.nextSide();
    }
    frameBufferCubemap.end();
    equiToCubeShader.end();
    equiToCubeShader.dispose();

    return frameBufferCubemap.getColorBufferTexture();
}
 
开发者ID:MovementSpeed,项目名称:nhglib,代码行数:32,代码来源:LightProbe.java

示例14: run

import com.badlogic.gdx.graphics.glutils.ShaderProgram; //导入方法依赖的package包/类
public void run (ShaderProgram program) {
	int texId = sm.getCurrentTextureId();
	fbo.begin();
	program.begin();
	getResult().bind(texId);
	program.setUniformi("u_texture", texId);
	program.setUniformf("u_viewport", width, height);
	addUniforms(program);
	quad.render(program, GL20.GL_TRIANGLES);
	if (saveBytes)
		data = getFrameBufferPixels(0, 0, width, height, false, data);
	program.end();
	fbo.end();
}
 
开发者ID:Quexten,项目名称:RavTech,代码行数:15,代码来源:Processor.java

示例15: prepareRender

import com.badlogic.gdx.graphics.glutils.ShaderProgram; //导入方法依赖的package包/类
/**
 * Prepare all lights for rendering.
 *
 * <p>You should need to use this method only if you want to render lights
 * on a frame buffer object. Use {@link #render()} otherwise.
 *
 * <p><b>NOTE!</b> Don't call this inside of any begin/end statements.
 *
 * @see #renderOnly()
 * @see #render()
 */
public void prepareRender() {
	lightRenderedLastFrame = 0;

	Gdx.gl.glDepthMask(false);
	Gdx.gl.glEnable(GL20.GL_BLEND);
	simpleBlendFunc.apply();

	boolean useLightMap = (shadows || blur);
	if (useLightMap) {
		lightMap.frameBuffer.begin();
		Gdx.gl.glClearColor(0f, 0f, 0f, 0f);
		Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
	}

	ShaderProgram shader = customLightShader != null ? customLightShader : lightShader;
	shader.begin();
	{
		shader.setUniformMatrix("u_projTrans", combined);
		if (customLightShader != null) updateLightShader();
		for (Light light : lightList) {
			if (customLightShader != null) updateLightShaderPerLight(light);
			light.render();
		}
	}
	shader.end();

	if (useLightMap) {
		if (customViewport) {
			lightMap.frameBuffer.end(
				viewportX,
				viewportY,
				viewportWidth,
				viewportHeight);
		} else {
			lightMap.frameBuffer.end();
		}

		boolean needed = lightRenderedLastFrame > 0;
		// this way lot less binding
		if (needed && blur)
			lightMap.gaussianBlur();
	}
}
 
开发者ID:bitbrain,项目名称:rbcgj-2016,代码行数:55,代码来源:RayHandler.java


注:本文中的com.badlogic.gdx.graphics.glutils.ShaderProgram.end方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。