本文整理汇总了Java中net.minecraft.client.renderer.OpenGlHelper.glBindBuffer方法的典型用法代码示例。如果您正苦于以下问题:Java OpenGlHelper.glBindBuffer方法的具体用法?Java OpenGlHelper.glBindBuffer怎么用?Java OpenGlHelper.glBindBuffer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.client.renderer.OpenGlHelper
的用法示例。
在下文中一共展示了OpenGlHelper.glBindBuffer方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onRenderWorld
import net.minecraft.client.renderer.OpenGlHelper; //导入方法依赖的package包/类
@SubscribeEvent(priority = EventPriority.LOWEST)
public void onRenderWorld(RenderWorldLastEvent event) {
if(renderers != null) try {
GlStateManager.pushMatrix();
GlStateManager.disableTexture2D();
GlStateManager.enableBlend();
GlStateManager.disableAlpha();
GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0);
GlStateManager.shadeModel(GL11.GL_SMOOTH);
if(!clear_buffer.get())
GlStateManager.disableDepth();
else {
GlStateManager.clearDepth(1.f);
GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT);
}
final boolean aa_enabled = anti_aliasing.get();
final int aa_max = anti_aliasing_max.get();
GlStateManager.glEnableClientState(GL11.GL_VERTEX_ARRAY);
GlStateManager.glEnableClientState(GL11.GL_COLOR_ARRAY);
renderers.forEach((chk, info) -> {
if (info.isVboPresent() && info.isRendering()) {
if(aa_enabled && (aa_max == 0 || info.getRenderCount() <= aa_max))
GL11.glEnable(GL11.GL_LINE_SMOOTH);
GlStateManager.pushMatrix();
BlockPos pos = chk.getPosition();
GlStateManager.translate(
(double) pos.getX() - renderingOffset.x,
(double) pos.getY() - renderingOffset.y,
(double) pos.getZ() - renderingOffset.z
);
chk.multModelviewMatrix();
info.getVbo().bindBuffer();
GlStateManager.glVertexPointer(
DefaultVertexFormats.POSITION_3F.getElementCount(),
DefaultVertexFormats.POSITION_3F.getType().getGlConstant(),
DefaultVertexFormats.POSITION_3F.getSize() + DefaultVertexFormats.COLOR_4UB.getSize(),
0
);
GlStateManager.glColorPointer(
DefaultVertexFormats.COLOR_4UB.getElementCount(),
DefaultVertexFormats.COLOR_4UB.getType().getGlConstant(),
DefaultVertexFormats.POSITION_3F.getSize() + DefaultVertexFormats.COLOR_4UB.getSize(),
DefaultVertexFormats.POSITION_3F.getSize()
);
info.getVbo().drawArrays(GL11.GL_LINES);
GlStateManager.popMatrix();
GL11.glDisable(GL11.GL_LINE_SMOOTH);
info.setRendering(false);
}
});
GL11.glDisable(GL11.GL_LINE_SMOOTH);
GlStateManager.glDisableClientState(GL11.GL_VERTEX_ARRAY);
GlStateManager.glDisableClientState(GL11.GL_COLOR_ARRAY);
OpenGlHelper.glBindBuffer(OpenGlHelper.GL_ARRAY_BUFFER, 0);
GlStateManager.shadeModel(GL11.GL_FLAT);
GlStateManager.disableBlend();
GlStateManager.enableAlpha();
GlStateManager.enableTexture2D();
GlStateManager.enableDepth();
GlStateManager.enableCull();
GlStateManager.popMatrix();
} catch (Exception e) {
handleException(null, e);
}
}
示例2: bindBuffer
import net.minecraft.client.renderer.OpenGlHelper; //导入方法依赖的package包/类
public void bindBuffer()
{
OpenGlHelper.glBindBuffer(OpenGlHelper.GL_ARRAY_BUFFER, this.glBufferId);
}
示例3: unbindBuffer
import net.minecraft.client.renderer.OpenGlHelper; //导入方法依赖的package包/类
public void unbindBuffer()
{
OpenGlHelper.glBindBuffer(OpenGlHelper.GL_ARRAY_BUFFER, 0);
}