use of net.minecraft.client.render.Tessellator in project ImmersivePortalsMod by qouteall.
the class MyRenderHelper method renderScreenTriangle.
static void renderScreenTriangle() {
GlStateManager.matrixMode(GL_MODELVIEW);
GlStateManager.pushMatrix();
GlStateManager.loadIdentity();
GlStateManager.matrixMode(GL_PROJECTION);
GlStateManager.pushMatrix();
GlStateManager.loadIdentity();
GlStateManager.disableAlphaTest();
GlStateManager.disableTexture();
GlStateManager.shadeModel(GL_SMOOTH);
GL20.glUseProgram(0);
GL11.glDisable(GL_CLIP_PLANE0);
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder bufferbuilder = tessellator.getBufferBuilder();
bufferbuilder.begin(GL_TRIANGLES, VertexFormats.POSITION_COLOR);
bufferbuilder.vertex(1, -1, 0).color(255, 255, 255, 255).next();
bufferbuilder.vertex(1, 1, 0).color(255, 255, 255, 255).next();
bufferbuilder.vertex(-1, 1, 0).color(255, 255, 255, 255).next();
bufferbuilder.vertex(-1, 1, 0).color(255, 255, 255, 255).next();
bufferbuilder.vertex(-1, -1, 0).color(255, 255, 255, 255).next();
bufferbuilder.vertex(1, -1, 0).color(255, 255, 255, 255).next();
tessellator.draw();
GlStateManager.matrixMode(GL_MODELVIEW);
GlStateManager.popMatrix();
GlStateManager.matrixMode(GL_PROJECTION);
GlStateManager.popMatrix();
GlStateManager.enableAlphaTest();
GlStateManager.enableTexture();
}
use of net.minecraft.client.render.Tessellator in project ImmersivePortalsMod by qouteall.
the class ViewAreaRenderer method drawPortalViewTriangle.
public static void drawPortalViewTriangle(Portal portal) {
MinecraftClient.getInstance().getProfiler().push("render_view_triangle");
DimensionRenderHelper helper = CGlobal.clientWorldLoader.getDimensionRenderHelper(portal.dimensionTo);
Vec3d fogColor = helper.getFogColor();
// important
GlStateManager.enableCull();
// In OpenGL, if you forget to set one rendering state and the result will be abnormal
// this design is bug-prone (DirectX is better in this aspect)
GuiLighting.disable();
GlStateManager.color4f(1, 1, 1, 1);
GlStateManager.disableFog();
GlStateManager.disableAlphaTest();
GlStateManager.disableTexture();
GlStateManager.shadeModel(GL11.GL_SMOOTH);
GlStateManager.disableBlend();
GlStateManager.disableLighting();
GL11.glDisable(GL_CLIP_PLANE0);
if (OFInterface.isShaders.getAsBoolean()) {
fogColor = Vec3d.ZERO;
}
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder bufferbuilder = tessellator.getBufferBuilder();
buildPortalViewAreaTrianglesBuffer(fogColor, portal, bufferbuilder, PortalRenderer.mc.gameRenderer.getCamera().getPos(), MyRenderHelper.partialTicks, portal instanceof Mirror ? 0 : 0.45F);
tessellator.draw();
GlStateManager.enableCull();
GlStateManager.enableAlphaTest();
GlStateManager.enableTexture();
GlStateManager.enableLighting();
MinecraftClient.getInstance().getProfiler().pop();
}
use of net.minecraft.client.render.Tessellator in project BedrockIfy by juancarloscp52.
the class AbstractPackScreenMixin method renderHeaderAndBottom.
/**
* Render top and bottom "dirt" bars when custom rotating background is enabled.
*/
@Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/pack/PackScreen;drawCenteredText(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/font/TextRenderer;Lnet/minecraft/text/Text;III)V", ordinal = 0))
private void renderHeaderAndBottom(CallbackInfo info) {
if (!Bedrockify.getInstance().settings.isCubemapBackgroundEnabled())
return;
headerWidth = Objects.requireNonNull(client).getWindow().getScaledWidth();
headerHeight = client.getWindow().getScaledHeight();
headerBottom = headerHeight - 51;
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder bufferBuilder = tessellator.getBuffer();
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
this.client.getTextureManager().bindTexture(DrawableHelper.BACKGROUND_TEXTURE);
RenderSystem.enableDepthTest();
RenderSystem.depthFunc(519);
float tilingSize = 32.0F;
// Top and bottom bars.
bufferBuilder.begin(7, VertexFormats.POSITION_TEXTURE_COLOR);
bufferBuilder.vertex(this.headerLeft, this.headerTop, -100.0D).texture(0.0F, (float) this.headerTop / tilingSize).color(64, 64, 64, 255).next();
bufferBuilder.vertex(this.headerLeft + this.headerWidth, this.headerTop, -100.0D).texture((float) this.headerWidth / tilingSize, (float) this.headerTop / tilingSize).color(64, 64, 64, 255).next();
bufferBuilder.vertex(this.headerLeft + this.headerWidth, 0.0D, -100.0D).texture((float) this.headerWidth / tilingSize, 0.0F).color(64, 64, 64, 255).next();
bufferBuilder.vertex(this.headerLeft, 0.0D, -100.0D).texture(0.0F, 0.0F).color(64, 64, 64, 255).next();
bufferBuilder.vertex(this.headerLeft, this.headerHeight, -100.0D).texture(0.0F, (float) this.headerHeight / tilingSize).color(64, 64, 64, 255).next();
bufferBuilder.vertex(this.headerLeft + this.headerWidth, this.headerHeight, -100.0D).texture((float) this.headerWidth / tilingSize, (float) this.headerHeight / tilingSize).color(64, 64, 64, 255).next();
bufferBuilder.vertex(this.headerLeft + this.headerWidth, this.headerBottom, -100.0D).texture((float) this.headerWidth / tilingSize, (float) this.headerBottom / tilingSize).color(64, 64, 64, 255).next();
bufferBuilder.vertex(this.headerLeft, this.headerBottom, -100.0D).texture(0.0F, (float) this.headerBottom / tilingSize).color(64, 64, 64, 255).next();
tessellator.draw();
RenderSystem.depthFunc(515);
RenderSystem.disableDepthTest();
RenderSystem.enableBlend();
RenderSystem.blendFuncSeparate(GlStateManager.SrcFactor.SRC_ALPHA, GlStateManager.DstFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SrcFactor.ZERO, GlStateManager.DstFactor.ONE);
RenderSystem.disableAlphaTest();
RenderSystem.shadeModel(7425);
RenderSystem.disableTexture();
// Top and bottom bar shadows.
bufferBuilder.begin(7, VertexFormats.POSITION_TEXTURE_COLOR);
bufferBuilder.vertex(this.headerLeft, this.headerTop + 4, 0.0D).texture(0.0F, 1.0F).color(0, 0, 0, 0).next();
bufferBuilder.vertex(this.headerWidth, this.headerTop + 4, 0.0D).texture(1.0F, 1.0F).color(0, 0, 0, 0).next();
bufferBuilder.vertex(this.headerWidth, this.headerTop, 0.0D).texture(1.0F, 0.0F).color(0, 0, 0, 255).next();
bufferBuilder.vertex(this.headerLeft, this.headerTop, 0.0D).texture(0.0F, 0.0F).color(0, 0, 0, 255).next();
bufferBuilder.vertex(this.headerLeft, this.headerBottom, 0.0D).texture(0.0F, 1.0F).color(0, 0, 0, 255).next();
bufferBuilder.vertex(this.headerWidth, this.headerBottom, 0.0D).texture(1.0F, 1.0F).color(0, 0, 0, 255).next();
bufferBuilder.vertex(this.headerWidth, this.headerBottom - 4, 0.0D).texture(1.0F, 0.0F).color(0, 0, 0, 0).next();
bufferBuilder.vertex(this.headerLeft, this.headerBottom - 4, 0.0D).texture(0.0F, 0.0F).color(0, 0, 0, 0).next();
tessellator.draw();
RenderSystem.enableTexture();
RenderSystem.shadeModel(7424);
RenderSystem.enableAlphaTest();
RenderSystem.disableBlend();
}
use of net.minecraft.client.render.Tessellator in project KiwiClient by TangyKiwi.
the class ShaderEffectWrapper method drawFramebufferToMain.
public void drawFramebufferToMain(String framebuffer) {
Framebuffer buffer = getFramebuffer(framebuffer);
Shader blitshader = mc.gameRenderer.blitScreenShader;
blitshader.addSampler("DiffuseSampler", buffer.getColorAttachment());
double w = mc.getWindow().getFramebufferWidth();
double h = mc.getWindow().getFramebufferHeight();
float ws = (float) buffer.viewportWidth / (float) buffer.textureWidth;
float hs = (float) buffer.viewportHeight / (float) buffer.textureHeight;
RenderSystem.enableBlend();
RenderSystem.blendFuncSeparate(GlStateManager.SrcFactor.SRC_ALPHA, GlStateManager.DstFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SrcFactor.ZERO, GlStateManager.DstFactor.ONE);
GlStateManager._colorMask(true, true, true, false);
GlStateManager._disableDepthTest();
GlStateManager._depthMask(false);
GlStateManager._viewport(0, 0, (int) w, (int) h);
blitshader.bind();
Tessellator tessellator = RenderSystem.renderThreadTesselator();
BufferBuilder bufferBuilder = tessellator.getBuffer();
bufferBuilder.begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION_TEXTURE_COLOR);
bufferBuilder.vertex(0, h, 0).texture(0f, 0f).color(255, 255, 255, 255).next();
bufferBuilder.vertex(w, h, 0).texture(ws, 0f).color(255, 255, 255, 255).next();
bufferBuilder.vertex(w, 0, 0).texture(ws, hs).color(255, 255, 255, 255).next();
bufferBuilder.vertex(0, 0, 0).texture(0f, hs).color(255, 255, 255, 255).next();
bufferBuilder.end();
BufferRenderer.postDraw(bufferBuilder);
blitshader.unbind();
GlStateManager._depthMask(true);
GlStateManager._colorMask(true, true, true, true);
RenderSystem.disableBlend();
}
use of net.minecraft.client.render.Tessellator in project fabric by FabricMC.
the class ItemRenderContext method renderModel.
public void renderModel(FabricBakedModel model, int color, ItemStack stack, VanillaQuadHandler vanillaHandler) {
this.color = color;
if (stack.isEmpty() && enchantmentStack != null) {
enchantment = true;
this.itemStack = enchantmentStack;
enchantmentStack = null;
} else {
enchantment = false;
this.itemStack = stack;
}
this.vanillaHandler = vanillaHandler;
Tessellator tessellator = Tessellator.getInstance();
bufferBuilder = tessellator.getBufferBuilder();
fabricBuffer = (AccessBufferBuilder) this.bufferBuilder;
bufferBuilder.begin(7, VertexFormats.POSITION_COLOR_UV_NORMAL);
model.emitItemQuads(stack, randomSupplier, this);
tessellator.draw();
if (smoothShading) {
GlStateManager.shadeModel(GL11.GL_FLAT);
smoothShading = false;
}
bufferBuilder = null;
fabricBuffer = null;
tessellator = null;
this.itemStack = null;
this.vanillaHandler = null;
}
Aggregations