當前位置: 首頁>>代碼示例>>Java>>正文


Java GlStateManager.glEnableClientState方法代碼示例

本文整理匯總了Java中net.minecraft.client.renderer.GlStateManager.glEnableClientState方法的典型用法代碼示例。如果您正苦於以下問題:Java GlStateManager.glEnableClientState方法的具體用法?Java GlStateManager.glEnableClientState怎麽用?Java GlStateManager.glEnableClientState使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在net.minecraft.client.renderer.GlStateManager的用法示例。


在下文中一共展示了GlStateManager.glEnableClientState方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onRenderWorld

import net.minecraft.client.renderer.GlStateManager; //導入方法依賴的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);
    }
}
 
開發者ID:fr1kin,項目名稱:ForgeHax,代碼行數:82,代碼來源:Markers.java


注:本文中的net.minecraft.client.renderer.GlStateManager.glEnableClientState方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。