Example usage for org.lwjgl.opengl GL11 glDepthFunc

List of usage examples for org.lwjgl.opengl GL11 glDepthFunc

Introduction

In this page you can find the example usage for org.lwjgl.opengl GL11 glDepthFunc.

Prototype

public static void glDepthFunc(@NativeType("GLenum") int func) 

Source Link

Document

Specifies the comparison that takes place during the depth buffer test (when GL11C#GL_DEPTH_TEST DEPTH_TEST is enabled).

Usage

From source file:tk.jacklin213.voxelgale.rendering.BasicRenderer.java

License:Apache License

private void initGL() {
    GL11.glEnable(GL11.GL_TEXTURE_2D);//  ww  w  .j  a  va2s.co  m
    GL11.glShadeModel(GL11.GL_SMOOTH);
    GL11.glClearColor(0, 0, 0, 0);
    GL11.glClearDepth(1);
    GL11.glEnable(GL11.GL_DEPTH_TEST);
    GL11.glDepthFunc(GL11.GL_LEQUAL);

    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glLoadIdentity();

    GLU.gluPerspective(45, (float) displayMode.getWidth() / (float) displayMode.getHeight(), 0.1f, 100);
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glHint(GL11.GL_PERSPECTIVE_CORRECTION_HINT, GL11.GL_NICEST);
}

From source file:zeldaswordskills.client.render.block.RenderTileEntityPedestal.java

License:Open Source License

public void renderPedestal(TileEntityPedestal pedestal, double dx, double dy, double dz, float f) {
    ItemStack sword = pedestal.getSword();
    if (sword != null) {
        GL11.glPushMatrix();//from   w ww .j  av  a2s.co m
        GL11.glTranslated(dx + 0.5D, dy + 0.9D, dz + 0.5D);
        bindTexture(field_147501_a.field_147553_e.getResourceLocation(sword.getItemSpriteNumber()));
        Tessellator tessellator = Tessellator.instance;
        IIcon icon = sword.getItem().getIconFromDamage(sword.getItemDamage());
        if (icon != null) {
            float minU = icon.getMinU();
            float maxU = icon.getMaxU();
            float minV = icon.getMinV();
            float maxV = icon.getMaxV();
            GL11.glRotatef(pedestal.getOrientation() == 0 ? 0F : 90F, 0.0F, 1.0F, 0.0F);
            GL11.glRotatef(135.0F, 0.0F, 0.0F, 1.0F);
            GL11.glTranslatef(-0.5F, -0.5F, 0.03125F);
            ItemRenderer.renderItemIn2D(tessellator, maxU, minV, minU, maxV, icon.getIconWidth(),
                    icon.getIconHeight(), 0.0625F);
            if (sword.hasEffect(0)) {
                GL11.glDepthFunc(GL11.GL_EQUAL);
                GL11.glDisable(GL11.GL_LIGHTING);
                bindTexture(glint);
                GL11.glEnable(GL11.GL_BLEND);
                GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE);
                float f7 = 0.76F;
                GL11.glColor4f(0.5F * f7, 0.25F * f7, 0.8F * f7, 1.0F);
                GL11.glMatrixMode(GL11.GL_TEXTURE);
                GL11.glPushMatrix();
                float f8 = 0.125F;
                GL11.glScalef(f8, f8, f8);
                float f9 = (float) (Minecraft.getSystemTime() % 3000L) / 3000.0F * 8.0F;
                GL11.glTranslatef(f9, 0.0F, 0.0F);
                GL11.glRotatef(-50.0F, 0.0F, 0.0F, 1.0F);
                ItemRenderer.renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 256, 256, 0.0625F);
                GL11.glPopMatrix();
                GL11.glPushMatrix();
                GL11.glScalef(f8, f8, f8);
                f9 = (float) (Minecraft.getSystemTime() % 4873L) / 4873.0F * 8.0F;
                GL11.glTranslatef(-f9, 0.0F, 0.0F);
                GL11.glRotatef(10.0F, 0.0F, 0.0F, 1.0F);
                ItemRenderer.renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 256, 256, 0.0625F);
                GL11.glPopMatrix();
                GL11.glMatrixMode(GL11.GL_MODELVIEW);
                GL11.glDisable(GL11.GL_BLEND);
                GL11.glEnable(GL11.GL_LIGHTING);
                GL11.glDepthFunc(GL11.GL_LEQUAL);
            }
            GL11.glPopMatrix();
        }
    }
}

From source file:zildo.fwk.opengl.OpenGLGestion.java

License:Open Source License

private void initGL() {
    GL11.glEnable(GL11.GL_TEXTURE_2D); // Enable Texture Mapping
    GL11.glShadeModel(GL11.GL_SMOOTH); // Enable Smooth Shading
    GL11.glClearColor(0.0f, 0.0f, 0.0f, 0.0f); // Black Background
    GL11.glClearDepth(1.0f); // Depth Buffer Setup
    GL11.glEnable(GL11.GL_DEPTH_TEST); // Enables Depth Testing
    GL11.glDepthFunc(GL11.GL_LEQUAL); // The Type Of Depth Testing To Do

    // initProjectionScene();

    GL11.glEnable(GL11.GL_CULL_FACE);//from   w w w . j  av  a 2 s.  c o  m

    ByteBuffer temp = ByteBuffer.allocateDirect(16);
    temp.order(ByteOrder.nativeOrder());
    GL11.glLight(GL11.GL_LIGHT1, GL11.GL_AMBIENT, (FloatBuffer) temp.asFloatBuffer().put(lightAmbient).flip()); // Setup The Ambient
    // Light
    GL11.glLight(GL11.GL_LIGHT1, GL11.GL_DIFFUSE, (FloatBuffer) temp.asFloatBuffer().put(lightDiffuse).flip()); // Setup The Diffuse
    // Light
    GL11.glLight(GL11.GL_LIGHT1, GL11.GL_POSITION,
            (FloatBuffer) temp.asFloatBuffer().put(lightPosition).flip()); // Position The
    // Light
    GL11.glEnable(GL11.GL_LIGHT1); // Enable Light One

    // GL11.glEnable(GL11.GL_LIGHTING);

    Display.setVSyncEnabled(true);

}

From source file:zildo.platform.opengl.LwjglOpenGLGestion.java

License:Open Source License

private void initGL() {
    GL11.glEnable(GL11.GL_TEXTURE_2D); // Enable Texture Mapping
    GL11.glShadeModel(GL11.GL_SMOOTH); // Enable Smooth Shading
    GL11.glClearColor(0.0f, 0.0f, 0.0f, 0.0f); // Black Background
    GL11.glClearDepth(1.0f); // Depth Buffer Setup
    GL11.glEnable(GL11.GL_DEPTH_TEST); // Enables Depth Testing
    GL11.glDepthFunc(GL11.GL_LEQUAL); // The Type Of Depth Testing To Do

    // initProjectionScene();

    GL11.glEnable(GL11.GL_CULL_FACE);/* w ww .  j ava  2s.  co m*/

    ByteBuffer temp = ByteBuffer.allocateDirect(16);
    temp.order(ByteOrder.nativeOrder());
    GL11.glLight(GL11.GL_LIGHT1, GL11.GL_AMBIENT, (FloatBuffer) temp.asFloatBuffer().put(lightAmbient).flip()); // Setup The Ambient
                                                                                                                // Light
    GL11.glLight(GL11.GL_LIGHT1, GL11.GL_DIFFUSE, (FloatBuffer) temp.asFloatBuffer().put(lightDiffuse).flip()); // Setup The Diffuse
                                                                                                                // Light
    GL11.glLight(GL11.GL_LIGHT1, GL11.GL_POSITION,
            (FloatBuffer) temp.asFloatBuffer().put(lightPosition).flip()); // Position The
                                                                                                                          // Light
    GL11.glEnable(GL11.GL_LIGHT1); // Enable Light One

    // GL11.glEnable(GL11.GL_LIGHTING);

    Display.setVSyncEnabled(true);

}