Java Code Examples for net.minecraft.client.renderer.OpenGlHelper#useVbo()
The following examples show how to use
net.minecraft.client.renderer.OpenGlHelper#useVbo() .
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: RenderGlobalSchematic.java From litematica with GNU Lesser General Public License v3.0 | 5 votes |
public RenderGlobalSchematic(Minecraft mc) { super(mc); this.mc = mc; this.renderManager = mc.getRenderManager(); this.vboEnabled = OpenGlHelper.useVbo(); if (this.vboEnabled) { this.renderContainer = new VboRenderListSchematic(); this.renderChunkFactory = new RenderChunkFactoryVbo(); } else { this.renderContainer = new RenderListSchematic(); this.renderChunkFactory = new RenderChunkFactoryList(); } BlockRendererDispatcher dispatcher = mc.getBlockRendererDispatcher(); this.blockModelShapes = dispatcher.getBlockModelShapes(); this.blockModelRenderer = new BlockModelRendererSchematic(mc.getBlockColors()); this.fluidRenderer = ((IMixinBlockRendererDispatcher) dispatcher).getFluidRenderer(); DataManager.getSchematicPlacementManager().addRebuildListener(this); }
Example 3
Source File: RenderGlobalSchematic.java From litematica with GNU Lesser General Public License v3.0 | 5 votes |
private void renderBlockOverlayBuffers(OverlayRenderType type) { this.mc.entityRenderer.enableLightmap(); if (OpenGlHelper.useVbo()) { GlStateManager.glEnableClientState(GL11.GL_VERTEX_ARRAY); GlStateManager.glEnableClientState(GL11.GL_COLOR_ARRAY); } this.renderContainer.renderBlockOverlays(type); if (OpenGlHelper.useVbo()) { for (VertexFormatElement element : DefaultVertexFormats.POSITION_COLOR.getElements()) { VertexFormatElement.EnumUsage usage = element.getUsage(); switch (usage) { case POSITION: GlStateManager.glDisableClientState(GL11.GL_VERTEX_ARRAY); break; case UV: OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit + element.getIndex()); GlStateManager.glDisableClientState(GL11.GL_TEXTURE_COORD_ARRAY); OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit); break; case COLOR: GlStateManager.glDisableClientState(GL11.GL_COLOR_ARRAY); GlStateManager.resetColor(); default: } } } this.mc.entityRenderer.disableLightmap(); }
Example 4
Source File: ChunkRenderDispatcherLitematica.java From litematica with GNU Lesser General Public License v3.0 | 5 votes |
public ListenableFuture<Object> uploadChunkBlocks(final BlockRenderLayer layer, final BufferBuilder buffer, final RenderChunkSchematicVbo renderChunk, final CompiledChunk compiledChunk, final double distanceSq) { if (Minecraft.getMinecraft().isCallingFromMinecraftThread()) { //if (GuiBase.isCtrlDown()) System.out.printf("uploadChunkBlocks()\n"); if (OpenGlHelper.useVbo()) { this.uploadVertexBuffer(buffer, renderChunk.getVertexBufferByLayer(layer.ordinal())); } else { this.uploadDisplayList(buffer, ((RenderChunkSchematicList) renderChunk).getDisplayList(layer, compiledChunk), renderChunk); } buffer.setTranslation(0.0D, 0.0D, 0.0D); return Futures.<Object>immediateFuture(null); } else { ListenableFutureTask<Object> futureTask = ListenableFutureTask.<Object>create(new Runnable() { @Override public void run() { ChunkRenderDispatcherLitematica.this.uploadChunkBlocks(layer, buffer, renderChunk, compiledChunk, distanceSq); } }, null); synchronized (this.queueChunkUploads) { this.queueChunkUploads.add(new ChunkRenderDispatcherLitematica.PendingUpload(futureTask, distanceSq)); return futureTask; } } }
Example 5
Source File: ChunkRenderDispatcherLitematica.java From litematica with GNU Lesser General Public License v3.0 | 5 votes |
public ListenableFuture<Object> uploadChunkOverlay(final OverlayRenderType type, final BufferBuilder buffer, final RenderChunkSchematicVbo renderChunk, final CompiledChunkSchematic compiledChunk, final double distanceSq) { if (Minecraft.getMinecraft().isCallingFromMinecraftThread()) { //if (GuiBase.isCtrlDown()) System.out.printf("uploadChunkOverlay()\n"); if (OpenGlHelper.useVbo()) { this.uploadVertexBuffer(buffer, renderChunk.getOverlayVertexBuffer(type)); } else { this.uploadDisplayList(buffer, ((RenderChunkSchematicList) renderChunk).getOverlayDisplayList(type, compiledChunk), renderChunk); } buffer.setTranslation(0.0D, 0.0D, 0.0D); return Futures.<Object>immediateFuture(null); } else { ListenableFutureTask<Object> futureTask = ListenableFutureTask.<Object>create(new Runnable() { @Override public void run() { ChunkRenderDispatcherLitematica.this.uploadChunkOverlay(type, buffer, renderChunk, compiledChunk, distanceSq); } }, null); synchronized (this.queueChunkUploads) { this.queueChunkUploads.add(new ChunkRenderDispatcherLitematica.PendingUpload(futureTask, distanceSq)); return futureTask; } } }
Example 6
Source File: CachedRendererFactory.java From OpenModsLib with MIT License | 5 votes |
public CachedRenderer createRenderer(Tessellator tes) { if (OpenGlHelper.useVbo()) { return new VboRenderer(tes); } else { return new DisplayListRenderer(tes); } }
Example 7
Source File: RenderGlobalSchematic.java From litematica with GNU Lesser General Public License v3.0 | 4 votes |
@Override public void loadRenderers() { World world = this.world; if (world != null) { if (this.renderDispatcher == null) { this.renderDispatcher = new ChunkRenderDispatcherLitematica(); } this.displayListEntitiesDirty = true; this.renderDistanceChunks = this.mc.gameSettings.renderDistanceChunks; boolean vboEnabledPrevious = this.vboEnabled; this.vboEnabled = OpenGlHelper.useVbo(); if (this.vboEnabled == false && vboEnabledPrevious) { this.renderContainer = new RenderListSchematic(); this.renderChunkFactory = new RenderChunkFactoryList(); } else if (this.vboEnabled && vboEnabledPrevious == false) { this.renderContainer = new VboRenderListSchematic(); this.renderChunkFactory = new RenderChunkFactoryVbo(); } if (this.viewFrustum != null) { this.viewFrustum.deleteGlResources(); } this.stopChunkUpdates(); synchronized (this.setTileEntities) { this.setTileEntities.clear(); } this.viewFrustum = new ViewFrustum(world, this.mc.gameSettings.renderDistanceChunks, this, this.renderChunkFactory); Entity entity = this.mc.getRenderViewEntity(); if (entity != null) { this.viewFrustum.updateChunkPositions(entity.posX, entity.posZ); } this.renderEntitiesStartupCounter = 2; } }
Example 8
Source File: RenderGlobalSchematic.java From litematica with GNU Lesser General Public License v3.0 | 4 votes |
private void renderBlockLayer(BlockRenderLayer layer) { this.mc.entityRenderer.enableLightmap(); if (OpenGlHelper.useVbo()) { 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); } this.renderContainer.renderChunkLayer(layer); if (OpenGlHelper.useVbo()) { for (VertexFormatElement vertexformatelement : DefaultVertexFormats.BLOCK.getElements()) { VertexFormatElement.EnumUsage vertexformatelement$enumusage = vertexformatelement.getUsage(); int index = vertexformatelement.getIndex(); switch (vertexformatelement$enumusage) { case POSITION: GlStateManager.glDisableClientState(GL11.GL_VERTEX_ARRAY); break; case UV: OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit + index); GlStateManager.glDisableClientState(GL11.GL_TEXTURE_COORD_ARRAY); OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit); break; case COLOR: GlStateManager.glDisableClientState(GL11.GL_COLOR_ARRAY); GlStateManager.resetColor(); default: } } } this.mc.entityRenderer.disableLightmap(); }