net.minecraft.client.renderer.vertex.VertexBuffer Java Examples
The following examples show how to use
net.minecraft.client.renderer.vertex.VertexBuffer.
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: RenderChunkSchematicVbo.java From litematica with GNU Lesser General Public License v3.0 | 6 votes |
public RenderChunkSchematicVbo(World worldIn, RenderGlobal renderGlobalIn, int indexIn) { super(worldIn, renderGlobalIn, indexIn); this.renderGlobal = (RenderGlobalSchematic) renderGlobalIn; this.chunkRenderDataLock = new ReentrantLock(); this.schematicChunkRenderData = CompiledChunkSchematic.EMPTY; if (OpenGlHelper.useVbo()) { for (int i = 0; i < OverlayRenderType.values().length; ++i) { this.vertexBufferOverlay[i] = new VertexBuffer(DefaultVertexFormats.POSITION_COLOR); } } }
Example #2
Source File: VboRenderListSchematic.java From litematica with GNU Lesser General Public License v3.0 | 5 votes |
private void renderBlocks(VertexBuffer vertexBuffer, RenderChunk renderChunk) { GlStateManager.pushMatrix(); this.preRenderChunk(renderChunk); //renderChunk.multModelviewMatrix(); vertexBuffer.bindBuffer(); this.setupArrayPointersBlocks(); vertexBuffer.drawArrays(GL11.GL_QUADS); GlStateManager.popMatrix(); }
Example #3
Source File: VboRenderListSchematic.java From litematica with GNU Lesser General Public License v3.0 | 5 votes |
private void renderOverlay(VertexBuffer vertexBuffer, RenderChunk renderChunk, int glMode) { GlStateManager.pushMatrix(); this.preRenderChunk(renderChunk); //renderChunk.multModelviewMatrix(); vertexBuffer.bindBuffer(); this.setupArrayPointersOverlay(); vertexBuffer.drawArrays(glMode); GlStateManager.popMatrix(); }
Example #4
Source File: RenderChunkSchematicVbo.java From litematica with GNU Lesser General Public License v3.0 | 4 votes |
public VertexBuffer getOverlayVertexBuffer(OverlayRenderType type) { //if (GuiBase.isCtrlDown()) System.out.printf("getOverlayVertexBuffer: type: %s, buf: %s\n", type, this.vertexBufferOverlay[type.ordinal()]); return this.vertexBufferOverlay[type.ordinal()]; }
Example #5
Source File: ChunkRenderDispatcherLitematica.java From litematica with GNU Lesser General Public License v3.0 | 4 votes |
private void uploadVertexBuffer(BufferBuilder bufferBuilder, VertexBuffer vertexBufferIn) { this.vertexBufferUploader.setVertexBuffer(vertexBufferIn); this.vertexBufferUploader.draw(bufferBuilder); }
Example #6
Source File: RenderUploader.java From ForgeHax with MIT License | 4 votes |
public RenderUploader(Uploaders<E> parent, VertexFormat format) { this.parent = parent; vertexBuffer = new VertexBuffer(format); }
Example #7
Source File: RenderUploader.java From ForgeHax with MIT License | 4 votes |
/** * Get the vertex buffer used to upload */ public VertexBuffer getVertexBuffer() { return vertexBuffer; }
Example #8
Source File: FastBlockModelRenderer.java From Valkyrien-Skies with Apache License 2.0 | 4 votes |
public static void renderVertexBuffer(VertexBuffer vertexBuffer) { // Check if optifine shaders are currently loaded. final boolean areOptifineShadersEnabled = GibsModelRegistry.isOptifineShadersEnabled(); GlStateManager.pushMatrix(); GlStateManager.resetColor(); GlStateManager.glEnableClientState(GL11.GL_VERTEX_ARRAY); OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit); GlStateManager.glEnableClientState(GL11.GL_TEXTURE_COORD_ARRAY); OpenGlHelper.setClientActiveTexture(OpenGlHelper.lightmapTexUnit); GlStateManager.glEnableClientState(GL11.GL_TEXTURE_COORD_ARRAY); OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit); GlStateManager.glEnableClientState(GL11.GL_COLOR_ARRAY); // Extra OpenGL states that must be enabled when shaders are enabled. if (areOptifineShadersEnabled) { GL11.glEnableClientState(32885); GL20.glEnableVertexAttribArray(11); GL20.glEnableVertexAttribArray(12); GL20.glEnableVertexAttribArray(10); } GlStateManager.pushMatrix(); vertexBuffer.bindBuffer(); // Even more OpenGL states that must be enabled when shaders are enabled. if (areOptifineShadersEnabled) { int vertexSizeI = 14; GL11.glVertexPointer(3, 5126, 56, 0L); GL11.glColorPointer(4, 5121, 56, 12L); GL11.glTexCoordPointer(2, 5126, 56, 16L); OpenGlHelper.setClientActiveTexture(OpenGlHelper.lightmapTexUnit); GL11.glTexCoordPointer(2, 5122, 56, 24L); OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit); GL11.glNormalPointer(5120, 56, 28L); GL20.glVertexAttribPointer(11, 2, 5126, false, 56, 32L); GL20.glVertexAttribPointer(12, 4, 5122, false, 56, 40L); GL20.glVertexAttribPointer(10, 3, 5122, false, 56, 48L); } else { GlStateManager.glVertexPointer(3, 5126, 28, 0); GlStateManager.glColorPointer(4, 5121, 28, 12); GlStateManager.glTexCoordPointer(2, 5126, 28, 16); OpenGlHelper.setClientActiveTexture(OpenGlHelper.lightmapTexUnit); GlStateManager.glTexCoordPointer(2, 5122, 28, 24); OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit); } vertexBuffer.drawArrays(7); GlStateManager.popMatrix(); vertexBuffer.unbindBuffer(); GlStateManager.resetColor(); for (VertexFormatElement vertexformatelement : DefaultVertexFormats.BLOCK.getElements()) { VertexFormatElement.EnumUsage vertexformatelement$enumusage = vertexformatelement .getUsage(); int i = vertexformatelement.getIndex(); switch (vertexformatelement$enumusage) { case POSITION: GlStateManager.glDisableClientState(32884); break; case UV: OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit + i); GlStateManager.glDisableClientState(32888); OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit); break; case COLOR: GlStateManager.glDisableClientState(32886); GlStateManager.resetColor(); } } OpenGlHelper.glBindBuffer(OpenGlHelper.GL_ARRAY_BUFFER, 0); // Finally disable some of those extra OpenGL states that were be enabled due to shaders. if (areOptifineShadersEnabled) { GL11.glDisableClientState(32885); GL20.glDisableVertexAttribArray(11); GL20.glDisableVertexAttribArray(12); GL20.glDisableVertexAttribArray(10); } GlStateManager.resetColor(); GlStateManager.popMatrix(); }