Java Code Examples for net.minecraft.client.renderer.BufferBuilder#finishDrawing()
The following examples show how to use
net.minecraft.client.renderer.BufferBuilder#finishDrawing() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: VBORenderType.java From CodeChickenLib with GNU Lesser General Public License v2.1 | 6 votes |
/** * Can be called runtime to have the Buffer rebuilt, * doing so has very limited applications and is not recommended. */ public void rebuild() { if (bufferId == -1) { bufferId = GL15.glGenBuffers(); } BufferBuilder builder = new BufferBuilder(getBufferSize()); builder.begin(getDrawMode(), getVertexFormat()); factory.accept(getVertexFormat(), builder); builder.finishDrawing(); Pair<BufferBuilder.DrawState, ByteBuffer> pair = builder.getNextBuffer(); ByteBuffer buffer = pair.getSecond(); count = buffer.remaining() / getVertexFormat().getSize(); GL15.glBindBuffer(GL_ARRAY_BUFFER, bufferId); GL15.glBufferData(GL_ARRAY_BUFFER, buffer, GL_STATIC_DRAW); GL15.glBindBuffer(GL_ARRAY_BUFFER, 0); }
Example 2
Source File: RenderChunkSchematicVbo.java From litematica with GNU Lesser General Public License v3.0 | 5 votes |
private void postRenderBlocks(BlockRenderLayer layer, float x, float y, float z, BufferBuilder buffer, CompiledChunkSchematic compiledChunk) { if (layer == BlockRenderLayer.TRANSLUCENT && compiledChunk.isLayerEmpty(layer) == false) { buffer.sortVertexData(x, y, z); compiledChunk.setBlockBufferState(layer, buffer.getVertexState()); } buffer.finishDrawing(); }
Example 3
Source File: RenderChunkSchematicVbo.java From litematica with GNU Lesser General Public License v3.0 | 5 votes |
private void postRenderOverlay(OverlayRenderType type, float x, float y, float z, BufferBuilder buffer, CompiledChunkSchematic compiledChunk) { if (type == OverlayRenderType.QUAD && compiledChunk.isOverlayTypeEmpty(type) == false) { buffer.sortVertexData(x, y, z); compiledChunk.setOverlayBufferState(type, buffer.getVertexState()); } buffer.finishDrawing(); }
Example 4
Source File: VBORenderType.java From CodeChickenLib with GNU Lesser General Public License v2.1 | 5 votes |
@Override public void finish(BufferBuilder buffer, int cameraX, int cameraY, int cameraZ) { buffer.finishDrawing();//We dont care about this, but we need to tell it to finish. buffer.getNextBuffer(); setupRenderState(); render(); clearRenderState(); }
Example 5
Source File: VBORenderType.java From CodeChickenLib with GNU Lesser General Public License v2.1 | 5 votes |
@Override public void finish(BufferBuilder buffer, int cameraX, int cameraY, int cameraZ) { buffer.finishDrawing();//We dont care about this, but we need to tell it to finish. buffer.getNextBuffer(); setupRenderState(); parent.render(); clearRenderState(); }
Example 6
Source File: OxygenTraceFX.java From AdvancedRocketry with MIT License | 5 votes |
@Override public void renderParticle(BufferBuilder worldRendererIn, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ) { //super.renderParticle(worldRendererIn, entityIn, partialTicks, rotationX, //rotationZ, rotationYZ, rotationXY, rotationXZ); float f11 = (float)(this.prevPosX + (this.posX - this.prevPosX) * (double)partialTicks - interpPosX); float f12 = (float)(this.prevPosY + (this.posY - this.prevPosY) * (double)partialTicks - interpPosY); float f13 = (float)(this.prevPosZ + (this.posZ - this.prevPosZ) * (double)partialTicks - interpPosZ); float f10 = 0.25F * this.particleScale; int i = 15728640; int j = i >> 16 & 65535; int k = i & 65535; Minecraft.getMinecraft().getTextureManager().bindTexture(icon); worldRendererIn.finishDrawing(); worldRendererIn.begin(GL11.GL_QUADS, DefaultVertexFormats.PARTICLE_POSITION_TEX_COLOR_LMAP); worldRendererIn.pos((double)(f11 - rotationX * f10 - rotationXY * f10), (double)(f12 - rotationZ * f10), (double)(f13 - rotationYZ * f10 - rotationXZ * f10)).tex(1, 1).color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha).lightmap(j, k).endVertex(); worldRendererIn.pos((double)(f11 - rotationX * f10 + rotationXY * f10), (double)(f12 + rotationZ * f10), (double)(f13 - rotationYZ * f10 + rotationXZ * f10)).tex(1, 0).color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha).lightmap(j, k).endVertex(); worldRendererIn.pos((double)(f11 + rotationX * f10 + rotationXY * f10), (double)(f12 + rotationZ * f10), (double)(f13 + rotationYZ * f10 + rotationXZ * f10)).tex(0, 0).color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha).lightmap(j, k).endVertex(); worldRendererIn.pos((double)(f11 + rotationX * f10 - rotationXY * f10), (double)(f12 - rotationZ * f10), (double)(f13 + rotationYZ * f10 - rotationXZ * f10)).tex(0, 1).color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha).lightmap(j, k).endVertex(); Tessellator.getInstance().draw(); worldRendererIn.begin(GL11.GL_QUADS, DefaultVertexFormats.PARTICLE_POSITION_TEX_COLOR_LMAP); }
Example 7
Source File: InverseTrailFx.java From AdvancedRocketry with MIT License | 5 votes |
@Override public void renderParticle(BufferBuilder worldRendererIn, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ) { //super.renderParticle(worldRendererIn, entityIn, partialTicks, rotationX, //rotationZ, rotationYZ, rotationXY, rotationXZ); float f11 = (float)(this.prevPosX + (this.posX - this.prevPosX) * (double)partialTicks - interpPosX); float f12 = (float)(this.prevPosY + (this.posY - this.prevPosY) * (double)partialTicks - interpPosY); float f13 = (float)(this.prevPosZ + (this.posZ - this.prevPosZ) * (double)partialTicks - interpPosZ); float f10 = 0.25F * this.particleScale; int i = this.getBrightnessForRender(partialTicks); int j = i >> 16 & 65535; int k = i & 65535; Minecraft.getMinecraft().getTextureManager().bindTexture(icon); worldRendererIn.finishDrawing(); worldRendererIn.begin(GL11.GL_QUADS, DefaultVertexFormats.PARTICLE_POSITION_TEX_COLOR_LMAP); worldRendererIn.pos((double)(f11 - rotationX * f10 - rotationXY * f10), (double)(f12 - rotationZ * f10), (double)(f13 - rotationYZ * f10 - rotationXZ * f10)).tex(1, 1).color(this.particleRed, this.particleGreen, this.particleBlue, 1f).lightmap(j, k).endVertex(); worldRendererIn.pos((double)(f11 - rotationX * f10 + rotationXY * f10), (double)(f12 + rotationZ * f10), (double)(f13 - rotationYZ * f10 + rotationXZ * f10)).tex(1, 0).color(this.particleRed, this.particleGreen, this.particleBlue, 1f).lightmap(j, k).endVertex(); worldRendererIn.pos((double)(f11 + rotationX * f10 + rotationXY * f10), (double)(f12 + rotationZ * f10), (double)(f13 + rotationYZ * f10 + rotationXZ * f10)).tex(0, 0).color(this.particleRed, this.particleGreen, this.particleBlue, 1f).lightmap(j, k).endVertex(); worldRendererIn.pos((double)(f11 + rotationX * f10 - rotationXY * f10), (double)(f12 - rotationZ * f10), (double)(f13 + rotationYZ * f10 - rotationXZ * f10)).tex(0, 1).color(this.particleRed, this.particleGreen, this.particleBlue, 1f).lightmap(j, k).endVertex(); Tessellator.getInstance().draw(); worldRendererIn.begin(GL11.GL_QUADS, DefaultVertexFormats.PARTICLE_POSITION_TEX_COLOR_LMAP); }
Example 8
Source File: OxygenCloudFX.java From AdvancedRocketry with MIT License | 5 votes |
@Override public void renderParticle(BufferBuilder worldRendererIn, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ) { //super.renderParticle(worldRendererIn, entityIn, partialTicks, rotationX, //rotationZ, rotationYZ, rotationXY, rotationXZ); float f11 = (float)(this.prevPosX + (this.posX - this.prevPosX) * (double)partialTicks - interpPosX); float f12 = (float)(this.prevPosY + (this.posY - this.prevPosY) * (double)partialTicks - interpPosY); float f13 = (float)(this.prevPosZ + (this.posZ - this.prevPosZ) * (double)partialTicks - interpPosZ); float f10 = 0.25F * this.particleScale; int i = 15728640; int j = i >> 16 & 65535; int k = i & 65535; Minecraft.getMinecraft().getTextureManager().bindTexture(icon); worldRendererIn.finishDrawing(); worldRendererIn.begin(GL11.GL_QUADS, DefaultVertexFormats.PARTICLE_POSITION_TEX_COLOR_LMAP); worldRendererIn.pos((double)(f11 - rotationX * f10 - rotationXY * f10), (double)(f12 - rotationZ * f10), (double)(f13 - rotationYZ * f10 - rotationXZ * f10)).tex(1, 1).color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha).lightmap(j, k).endVertex(); worldRendererIn.pos((double)(f11 - rotationX * f10 + rotationXY * f10), (double)(f12 + rotationZ * f10), (double)(f13 - rotationYZ * f10 + rotationXZ * f10)).tex(1, 0).color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha).lightmap(j, k).endVertex(); worldRendererIn.pos((double)(f11 + rotationX * f10 + rotationXY * f10), (double)(f12 + rotationZ * f10), (double)(f13 + rotationYZ * f10 + rotationXZ * f10)).tex(0, 0).color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha).lightmap(j, k).endVertex(); worldRendererIn.pos((double)(f11 + rotationX * f10 - rotationXY * f10), (double)(f12 - rotationZ * f10), (double)(f13 + rotationYZ * f10 - rotationXZ * f10)).tex(0, 1).color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha).lightmap(j, k).endVertex(); Tessellator.getInstance().draw(); worldRendererIn.begin(GL11.GL_QUADS, DefaultVertexFormats.PARTICLE_POSITION_TEX_COLOR_LMAP); }
Example 9
Source File: FxGravityEffect.java From AdvancedRocketry with MIT License | 5 votes |
@Override public void renderParticle(BufferBuilder worldRendererIn, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ) { //super.renderParticle(worldRendererIn, entityIn, partialTicks, rotationX, //rotationZ, rotationYZ, rotationXY, rotationXZ); float f11 = (float)(this.prevPosX + (this.posX - this.prevPosX) * (double)partialTicks - interpPosX); float f12 = (float)(this.prevPosY + (this.posY - this.prevPosY) * (double)partialTicks - interpPosY); float f13 = (float)(this.prevPosZ + (this.posZ - this.prevPosZ) * (double)partialTicks - interpPosZ); float f10 = 0.25F * this.particleScale; int i = this.getBrightnessForRender(partialTicks); int j = i >> 16 & 65535; int k = i & 65535; Minecraft.getMinecraft().getTextureManager().bindTexture(icon); worldRendererIn.finishDrawing(); worldRendererIn.begin(GL11.GL_QUADS, DefaultVertexFormats.PARTICLE_POSITION_TEX_COLOR_LMAP); worldRendererIn.pos((double)(f11 - rotationX * f10 - rotationXY * f10), (double)(f12 - rotationZ * f10), (double)(f13 - rotationYZ * f10 - rotationXZ * f10)).tex(1, 1).color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha).lightmap(j, k).endVertex(); worldRendererIn.pos((double)(f11 - rotationX * f10 + rotationXY * f10), (double)(f12 + rotationZ * f10), (double)(f13 - rotationYZ * f10 + rotationXZ * f10)).tex(1, 0).color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha).lightmap(j, k).endVertex(); worldRendererIn.pos((double)(f11 + rotationX * f10 + rotationXY * f10), (double)(f12 + rotationZ * f10), (double)(f13 + rotationYZ * f10 + rotationXZ * f10)).tex(0, 0).color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha).lightmap(j, k).endVertex(); worldRendererIn.pos((double)(f11 + rotationX * f10 - rotationXY * f10), (double)(f12 - rotationZ * f10), (double)(f13 + rotationYZ * f10 - rotationXZ * f10)).tex(0, 1).color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha).lightmap(j, k).endVertex(); Tessellator.getInstance().draw(); worldRendererIn.begin(GL11.GL_QUADS, DefaultVertexFormats.PARTICLE_POSITION_TEX_COLOR_LMAP); }
Example 10
Source File: GuiProgressBarContainer.java From AdvancedRocketry with MIT License | 5 votes |
/** * Draws a textured rectangle at the stored z-value. Args: x, y, u, v, width, height */ public void drawTexturedModalRectWithCustomSize(int x, int y, int u, int v, int width, int height) { BufferBuilder buffer = Tessellator.getInstance().getBuffer(); float f = 0.00390625F; float f1 = 0.00390625F; buffer.begin(GL11.GL_QUADS, buffer.getVertexFormat()); RenderHelper.renderNorthFaceWithUV(buffer, this.zLevel, x, y, x + width, y + height, (u + 0) * f, (u + width) * f, (v + 0) * f1, (v + height) * f1); buffer.finishDrawing(); }
Example 11
Source File: ModuleOreMapper.java From AdvancedRocketry with MIT License | 4 votes |
@Override public void renderForeground(int guiOffsetX, int guiOffsetY, int mouseX, int mouseY, float zLevel, GuiContainer gui, FontRenderer font) { super.renderForeground(guiOffsetX, guiOffsetY, mouseX, mouseY, zLevel, gui, font); BufferBuilder buffer = Tessellator.getInstance().getBuffer(); //Draw fancy things GlStateManager.disableTexture2D(); buffer.color(0f, 0.8f, 0f, 1f); buffer.begin(GL11.GL_QUADS, buffer.getVertexFormat()); buffer.pos(-21, 82 + fancyScanOffset, (double)zLevel).endVertex(); buffer.pos(0, 84 + fancyScanOffset, (double)zLevel).endVertex(); buffer.pos(0, 81 + fancyScanOffset, (double)zLevel).endVertex(); buffer.pos(-21, 81 + fancyScanOffset, (double)zLevel).endVertex(); buffer.finishDrawing(); buffer.begin(GL11.GL_QUADS, buffer.getVertexFormat()); buffer.pos(-21, 82 - fancyScanOffset + FANCYSCANMAXSIZE, (double)zLevel).endVertex(); buffer.pos(0, 84 - fancyScanOffset + FANCYSCANMAXSIZE, (double)zLevel).endVertex(); buffer.pos(0, 81 - fancyScanOffset + FANCYSCANMAXSIZE, (double)zLevel).endVertex(); buffer.pos(-21, 81 - fancyScanOffset + FANCYSCANMAXSIZE, (double)zLevel).endVertex(); buffer.finishDrawing(); GlStateManager.enableBlend(); GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_DST_ALPHA); buffer.color(0.5f, 0.5f, 0.0f,0.3f + ((float)Math.sin(Math.PI*(fancyScanOffset/(float)FANCYSCANMAXSIZE))/3f)); buffer.begin(GL11.GL_QUADS, buffer.getVertexFormat()); RenderHelper.renderNorthFace(buffer, (double)zLevel, 173, 82, 194, 141); buffer.finishDrawing(); GlStateManager.enableTexture2D(); GlStateManager.disableBlend(); if(world.getTotalWorldTime() - prevWorldTickTime >= 1 ) { prevWorldTickTime = world.getTotalWorldTime(); if(fancyScanOffset >= FANCYSCANMAXSIZE) fancyScanOffset = 0; else fancyScanOffset++; } //If a slot is selected draw an indicator int slot; if((slot = tile.getSelectedSlot()) != -1) { GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glColor3f(0f, 0.8f, 0f); buffer.begin(GL11.GL_QUADS, buffer.getVertexFormat()); RenderHelper.renderNorthFaceWithUV(buffer, zLevel, 13 + (18*slot), 155, 13 + 16 + (18*slot), 155 + 16, 0, 1, 0, 1); buffer.finishDrawing(); GL11.glEnable(GL11.GL_TEXTURE_2D); } }
Example 12
Source File: GuiOreMappingSatellite.java From AdvancedRocketry with MIT License | 4 votes |
@Override protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) { BufferBuilder buffer = Tessellator.getInstance().getBuffer(); //Draw fancy things GlStateManager.disableTexture2D(); GlStateManager.color(0f, 0.8f, 0f); buffer.begin(GL11.GL_QUADS, buffer.getVertexFormat()); buffer.pos(-21, 82 + fancyScanOffset, (double)this.zLevel).endVertex(); buffer.pos(0, 84 + fancyScanOffset, (double)this.zLevel).endVertex(); buffer.pos(0, 81 + fancyScanOffset, (double)this.zLevel).endVertex(); buffer.pos(-21, 81 + fancyScanOffset, (double)this.zLevel).endVertex(); buffer.finishDrawing(); buffer.begin(GL11.GL_QUADS, buffer.getVertexFormat()); buffer.pos(-21, 82 - fancyScanOffset + FANCYSCANMAXSIZE, (double)this.zLevel).endVertex(); buffer.pos(0, 84 - fancyScanOffset + FANCYSCANMAXSIZE, (double)this.zLevel).endVertex(); buffer.pos(0, 81 - fancyScanOffset + FANCYSCANMAXSIZE, (double)this.zLevel).endVertex(); buffer.pos(-21, 81 - fancyScanOffset + FANCYSCANMAXSIZE, (double)this.zLevel).endVertex(); buffer.finishDrawing(); GlStateManager.enableBlend(); GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_DST_ALPHA); GlStateManager.color(0.5f, 0.5f, 0.0f,0.3f + ((float)Math.sin(Math.PI*(fancyScanOffset/(float)FANCYSCANMAXSIZE))/3f)); buffer.begin(GL11.GL_QUADS, buffer.getVertexFormat()); RenderHelper.renderNorthFace(buffer, this.zLevel, 173, 82, 194, 141); buffer.finishDrawing(); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_BLEND); if(world.getTotalWorldTime() - prevWorldTickTime >= 1 ) { prevWorldTickTime = world.getTotalWorldTime(); if(fancyScanOffset >= FANCYSCANMAXSIZE) fancyScanOffset = 0; else fancyScanOffset++; } //If a slot is selected draw an indicator int slot; if(tile != null && (slot = tile.getSelectedSlot()) != -1) { GlStateManager.disableTexture2D(); GlStateManager.color(0f, 0.8f, 0f, 1f); buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX); RenderHelper.renderNorthFaceWithUV(buffer, this.zLevel, 13 + (18*slot), 155, 13 + 16 + (18*slot), 155 + 16, 0, 1, 0, 1); Tessellator.getInstance().draw(); GlStateManager.enableTexture2D(); } }
Example 13
Source File: RenderLaser.java From AdvancedRocketry with MIT License | 4 votes |
@Override public void doRender(Entity entity, double x, double y, double z, float f, float f1) { GL11.glPushMatrix(); GL11.glTranslated(x, y, z); BufferBuilder buffer = Tessellator.getInstance().getBuffer(); GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_FOG); GL11.glEnable(GL11.GL_BLEND); GL11.glDepthMask(false); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); Minecraft.getMinecraft().renderEngine.bindTexture(flare); //bindTexture(flare); buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.OLDMODEL_POSITION_TEX_NORMAL); buffer.color(flareColor[0],flareColor[1],flareColor[2],flareColor[3]); for(int i = 0; i < 4; i++) { RenderHelper.renderBottomFaceWithUV(buffer, -y + 200, -(i*6) - x, -(i*6) - z, (i*6) - x, (i*6) - z, 0, 1, 0, 1); } buffer.finishDrawing(); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE); buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION); GlStateManager.color(color[0], color[1], color[2], color[3]);//0.9F, 0.2F, 0.3F, 0.5F); for(float radius = 0.25F; radius < size; radius += .25F) { for(double i = 0; i < 2*Math.PI; i += Math.PI) { buffer.pos(- x , -y + 200, - z).endVertex(); buffer.pos(- x, -y + 200, - z).endVertex(); buffer.pos(- (radius* Math.cos(i)) + 0.5F, 0,- (radius* Math.sin(i)) + 0.5F).endVertex(); buffer.pos(+ (radius* Math.sin(i)) + 0.5F, 0, (radius* Math.cos(i)) + 0.5F).endVertex(); } for(double i = 0; i < 2*Math.PI; i += Math.PI) { buffer.pos(- x, -y + 200,- z).endVertex(); buffer.pos(- x, -y + 200, - z).endVertex(); buffer.pos(+ (radius* Math.sin(i)) + 0.5F, 0, -(radius* Math.cos(i)) + 0.5F).endVertex(); buffer.pos(- (radius* Math.cos(i)) + 0.5F, 0,(radius* Math.sin(i)) + 0.5F).endVertex(); } } Tessellator.getInstance().draw(); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_FOG); GL11.glDepthMask(true); GL11.glPopMatrix(); GlStateManager.color(1, 1, 1,1); }