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