本文整理汇总了Java中net.minecraft.client.renderer.OpenGlHelper.glFramebufferTexture2D方法的典型用法代码示例。如果您正苦于以下问题:Java OpenGlHelper.glFramebufferTexture2D方法的具体用法?Java OpenGlHelper.glFramebufferTexture2D怎么用?Java OpenGlHelper.glFramebufferTexture2D使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.client.renderer.OpenGlHelper
的用法示例。
在下文中一共展示了OpenGlHelper.glFramebufferTexture2D方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createFramebuffer
import net.minecraft.client.renderer.OpenGlHelper; //导入方法依赖的package包/类
public void createFramebuffer(int width, int height)
{
this.framebufferWidth = width;
this.framebufferHeight = height;
this.framebufferTextureWidth = width;
this.framebufferTextureHeight = height;
if (!OpenGlHelper.isFramebufferEnabled())
{
this.framebufferClear();
}
else
{
this.framebufferObject = OpenGlHelper.glGenFramebuffers();
this.framebufferTexture = TextureUtil.glGenTextures();
if (this.useDepth)
{
this.depthBuffer = OpenGlHelper.glGenRenderbuffers();
}
this.setFramebufferFilter(9728);
GlStateManager.bindTexture(this.framebufferTexture);
GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGBA8, this.framebufferTextureWidth, this.framebufferTextureHeight, 0, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, (ByteBuffer)((ByteBuffer)null));
OpenGlHelper.glBindFramebuffer(OpenGlHelper.GL_FRAMEBUFFER, this.framebufferObject);
OpenGlHelper.glFramebufferTexture2D(OpenGlHelper.GL_FRAMEBUFFER, OpenGlHelper.GL_COLOR_ATTACHMENT0, 3553, this.framebufferTexture, 0);
if (this.useDepth)
{
OpenGlHelper.glBindRenderbuffer(OpenGlHelper.GL_RENDERBUFFER, this.depthBuffer);
OpenGlHelper.glRenderbufferStorage(OpenGlHelper.GL_RENDERBUFFER, 33190, this.framebufferTextureWidth, this.framebufferTextureHeight);
OpenGlHelper.glFramebufferRenderbuffer(OpenGlHelper.GL_FRAMEBUFFER, OpenGlHelper.GL_DEPTH_ATTACHMENT, OpenGlHelper.GL_RENDERBUFFER, this.depthBuffer);
}
this.framebufferClear();
this.unbindFramebufferTexture();
}
}
示例2: renderGuiStart
import net.minecraft.client.renderer.OpenGlHelper; //导入方法依赖的package包/类
/**
* Called from asm modified code
* {@link net.minecraft.client.renderer.EntityRenderer#updateCameraAndRender(float, long) updateCameraAndRender}
*/
public static void renderGuiStart() {
if (renderMethod.getResizeGui()) {
Minecraft mc = Minecraft.getMinecraft();
framebuffer.bindFramebuffer(false);
GlStateManager.viewport(0, 0, (int) (mc.displayHeight*renderMethod.getQuality()), (int) (mc.displayHeight*renderMethod.getQuality()));
OpenGlHelper.glFramebufferTexture2D(OpenGlHelper.GL_FRAMEBUFFER, OpenGlHelper.GL_COLOR_ATTACHMENT0, GL11.GL_TEXTURE_2D, framebufferTextures[0], 0);
GlStateManager.bindTexture(0);
}
}
示例3: createFramebuffer
import net.minecraft.client.renderer.OpenGlHelper; //导入方法依赖的package包/类
public void createFramebuffer(int width, int height)
{
this.framebufferWidth = width;
this.framebufferHeight = height;
this.framebufferTextureWidth = width;
this.framebufferTextureHeight = height;
if (!OpenGlHelper.isFramebufferEnabled())
{
this.framebufferClear();
}
else
{
this.framebufferObject = OpenGlHelper.glGenFramebuffers();
this.framebufferTexture = TextureUtil.glGenTextures();
if (this.useDepth)
{
this.depthBuffer = OpenGlHelper.glGenRenderbuffers();
}
this.setFramebufferFilter(9728);
GlStateManager.bindTexture(this.framebufferTexture);
GlStateManager.glTexImage2D(3553, 0, 32856, this.framebufferTextureWidth, this.framebufferTextureHeight, 0, 6408, 5121, (IntBuffer)null);
OpenGlHelper.glBindFramebuffer(OpenGlHelper.GL_FRAMEBUFFER, this.framebufferObject);
OpenGlHelper.glFramebufferTexture2D(OpenGlHelper.GL_FRAMEBUFFER, OpenGlHelper.GL_COLOR_ATTACHMENT0, 3553, this.framebufferTexture, 0);
if (this.useDepth)
{
OpenGlHelper.glBindRenderbuffer(OpenGlHelper.GL_RENDERBUFFER, this.depthBuffer);
OpenGlHelper.glRenderbufferStorage(OpenGlHelper.GL_RENDERBUFFER, 33190, this.framebufferTextureWidth, this.framebufferTextureHeight);
OpenGlHelper.glFramebufferRenderbuffer(OpenGlHelper.GL_FRAMEBUFFER, OpenGlHelper.GL_DEPTH_ATTACHMENT, OpenGlHelper.GL_RENDERBUFFER, this.depthBuffer);
}
this.framebufferClear();
this.unbindFramebufferTexture();
}
}
示例4: renderWorld
import net.minecraft.client.renderer.OpenGlHelper; //导入方法依赖的package包/类
/**
* Render the world.
* Called between {@link net.minecraft.client.renderer.EntityRenderer#renderWorld(float, long) renderWorld}
* and {@link net.minecraft.client.renderer.EntityRenderer#renderWorldPass(int, float, long) renderWorldPass}
*/
public void renderWorld(EntityRenderer er, Minecraft mc, Framebuffer framebuffer, Shader shader,
int[] framebufferTextures, float partialTicks, long finishTimeNano, int width, int height, float sizeIncrease) {
//save the players state
player = mc.getRenderViewEntity();
yaw = player.rotationYaw;
pitch = player.rotationPitch;
prevYaw = player.prevRotationYaw;
prevPitch = player.prevRotationPitch;
//clear the primary framebuffer
mc.getFramebuffer().framebufferClear();
//clear the secondary framebuffer
framebuffer.framebufferClear();
//bind the secondary framebuffer
framebuffer.bindFramebuffer(false);
//displayWidth and displayHeight are called during world rendering
//set them to the secondary framebuffer dimensions
mc.displayWidth = (int)(height*sizeIncrease);
mc.displayHeight = (int)(height*sizeIncrease); //Must be square
RenderUtil.partialWidth = mc.displayWidth; //TODO is this even needed?
RenderUtil.partialHeight = mc.displayHeight; //TODO remove
RenderUtil.render360 = true;
Globe globe = globes[globeIndex];
for (int i=0; i<globe.getCount(); i++) {
// set camera/player rotation state (read by hooks at the correct moment)
coordFrame = globe.getCoordFrame(i);
playerFov = globe.getFov(i);
// the forward vector is the opposite direction of the z-axis
float x = -coordFrame.get(2);
float y = -coordFrame.get(6);
float z = -coordFrame.get(10);
// calculate the delta yaw/pitch to point the player
float lon = (float)Math.atan2(x, -z);
float lat = (float)Math.atan2(y, Math.sqrt(x*x+z*z));
playerDeltaYaw = lon;
playerDeltaPitch = lat;
// render to texture
OpenGlHelper.glFramebufferTexture2D(OpenGlHelper.GL_FRAMEBUFFER, OpenGlHelper.GL_COLOR_ATTACHMENT0, GL11.GL_TEXTURE_2D, framebufferTextures[i], 0);
GlStateManager.bindTexture(0);
er.renderWorldPass(2, partialTicks, finishTimeNano);
// reset player view
player.rotationYaw = yaw;
player.rotationPitch = pitch;
player.prevRotationYaw = prevYaw;
player.prevRotationPitch = prevPitch;
}
//reset displayWidth and displayHeight to the primary framebuffer dimensions
mc.displayWidth = width;
mc.displayHeight = height;
//reset viewport to full screen
GlStateManager.viewport(0, 0, width, height);
//bind primary framebuffer
mc.getFramebuffer().bindFramebuffer(false);
if (!getResizeGui() || mc.gameSettings.hideGUI) {
GL20.glUseProgram(shader.getShaderProgram());
int cursorUniform = GL20.glGetUniformLocation(shader.getShaderProgram(), "drawCursor");
GL20.glUniform1i(cursorUniform, 0);
runShader(mc, shader, framebufferTextures);
}
}
示例5: createFramebuffer
import net.minecraft.client.renderer.OpenGlHelper; //导入方法依赖的package包/类
public void createFramebuffer(int width, int height)
{
this.framebufferWidth = width;
this.framebufferHeight = height;
this.framebufferTextureWidth = width;
this.framebufferTextureHeight = height;
if (!OpenGlHelper.isFramebufferEnabled())
{
this.framebufferClear();
}
else
{
this.framebufferObject = OpenGlHelper.glGenFramebuffers();
this.framebufferTexture = TextureUtil.glGenTextures();
if (this.useDepth)
{
this.depthBuffer = OpenGlHelper.glGenRenderbuffers();
}
this.setFramebufferFilter(9728);
GlStateManager.bindTexture(this.framebufferTexture);
GlStateManager.glTexImage2D(3553, 0, 32856, this.framebufferTextureWidth, this.framebufferTextureHeight, 0, 6408, 5121, (IntBuffer)null);
OpenGlHelper.glBindFramebuffer(OpenGlHelper.GL_FRAMEBUFFER, this.framebufferObject);
OpenGlHelper.glFramebufferTexture2D(OpenGlHelper.GL_FRAMEBUFFER, OpenGlHelper.GL_COLOR_ATTACHMENT0, 3553, this.framebufferTexture, 0);
if (this.useDepth)
{
OpenGlHelper.glBindRenderbuffer(OpenGlHelper.GL_RENDERBUFFER, this.depthBuffer);
if (!this.stencilEnabled)
{
OpenGlHelper.glRenderbufferStorage(OpenGlHelper.GL_RENDERBUFFER, 33190, this.framebufferTextureWidth, this.framebufferTextureHeight);
OpenGlHelper.glFramebufferRenderbuffer(OpenGlHelper.GL_FRAMEBUFFER, OpenGlHelper.GL_DEPTH_ATTACHMENT, OpenGlHelper.GL_RENDERBUFFER, this.depthBuffer);
}
else
{
OpenGlHelper.glRenderbufferStorage(OpenGlHelper.GL_RENDERBUFFER, org.lwjgl.opengl.EXTPackedDepthStencil.GL_DEPTH24_STENCIL8_EXT, this.framebufferTextureWidth, this.framebufferTextureHeight);
OpenGlHelper.glFramebufferRenderbuffer(OpenGlHelper.GL_FRAMEBUFFER, org.lwjgl.opengl.EXTFramebufferObject.GL_DEPTH_ATTACHMENT_EXT, OpenGlHelper.GL_RENDERBUFFER, this.depthBuffer);
OpenGlHelper.glFramebufferRenderbuffer(OpenGlHelper.GL_FRAMEBUFFER, org.lwjgl.opengl.EXTFramebufferObject.GL_STENCIL_ATTACHMENT_EXT, OpenGlHelper.GL_RENDERBUFFER, this.depthBuffer);
}
}
this.framebufferClear();
this.unbindFramebufferTexture();
}
}