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


Java ShaderProgram.dispose方法代码示例

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


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

示例1: 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

示例2: 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

示例3: addGLProgram

import com.badlogic.gdx.graphics.glutils.ShaderProgram; //导入方法依赖的package包/类
/** adds a GLProgram to the cache for a given name */
public void addGLProgram(ShaderProgram program, String key) {
	ShaderProgram ret = _programs.put(key, program);
	if(ret != null) {
		ret.dispose();
		CCLog.engine(TAG, "reset key program : " + key);
	}
}
 
开发者ID:mingwuyun,项目名称:cocos2d-java,代码行数:9,代码来源:GLProgramCache.java

示例4: removeGLProgram

import com.badlogic.gdx.graphics.glutils.ShaderProgram; //导入方法依赖的package包/类
public void removeGLProgram(String key) {
	ShaderProgram ret = _programs.remove(key);
	if(ret != null) {
		ret.dispose();
	} else {
		CCLog.error(TAG, "program not found.  key : " + key);
	}
}
 
开发者ID:mingwuyun,项目名称:cocos2d-java,代码行数:9,代码来源:GLProgramCache.java

示例5: 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

示例6: dispose

import com.badlogic.gdx.graphics.glutils.ShaderProgram; //导入方法依赖的package包/类
/** Dispose this ShaderManager with all shaders and framebuffers */
public void dispose () {
	for (ShaderProgram sp : shaders.values())
		sp.dispose();
	for (FrameBuffer fb : frameBuffers.values())
		fb.dispose();
	shaders.clear();
	frameBuffers.clear();
}
 
开发者ID:Quexten,项目名称:RavTech,代码行数:10,代码来源:ShaderManager.java


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