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:com.runescape.client.revised.editor.modelviewer.Main.java

License:Open Source License

public static void initialize(final Canvas modelCanvas) {
    try {/*w w  w . j  a  v  a2s .c o  m*/
        Display.setParent(modelCanvas);
        Display.create(new PixelFormat(8, 24, 8, 8));
        Display.makeCurrent();
    } catch (final LWJGLException lwjgle) {
        try {
            Display.create(new PixelFormat(8, 24, 8, 0));
        } catch (final LWJGLException e) {
            e.printStackTrace();
        }
    }
    Display.setVSyncEnabled(false);
    Display.setSwapInterval(0);
    GL11.glShadeModel(GL11.GL_SMOOTH);
    GL11.glClearColor(0.0F, 0.0F, 0.0F, 0.0F);
    GL11.glEnable(GL11.GL_DEPTH_TEST);
    GL11.glClearDepth(1.0F);
    GL11.glDepthFunc(GL11.GL_LEQUAL);
    GL11.glHint(GL11.GL_PERSPECTIVE_CORRECTION_HINT, GL11.GL_NICEST);
    GL11.glEnable(GL11.GL_NORMALIZE);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glEnable(GL11.GL_POINT_SMOOTH);
    GL11.glEnable(GL11.GL_POLYGON_SMOOTH);
    GL11.glEnable(GL11.GL_LINE_SMOOTH);
    GL11.glEnable(GL11.GL_COLOR_MATERIAL);
    GL11.glEnable(GL11.GL_ALPHA_TEST);
    GL11.glEnable(GL11.GL_CULL_FACE);
    GL11.glEnable(GL11.GL_COLOR_MATERIAL);
    GL11.glColorMaterial(GL11.GL_FRONT, GL11.GL_DIFFUSE);
    GL11.glCullFace(GL11.GL_BACK);
}

From source file:com.rvantwisk.cnctools.controls.opengl.OpenGLRenderer.java

License:Open Source License

protected void init() {
    GL11.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
    GL11.glClearDepth(1.0);//www.  ja v  a2 s  . com
    GL11.glDepthFunc(GL11.GL_LEQUAL);
    GL11.glEnable(GL11.GL_COLOR_MATERIAL);
    GL11.glEnable(GL11.GL_DEPTH_TEST);
    GL11.glEnable(GL11.GL_CULL_FACE);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

}

From source file:com.shinoow.abyssalcraft.client.render.entity.RenderDragonBoss.java

License:Apache License

/**
 * Renders the dragon model. Called by renderModel.
 *//* w ww .  j a va  2 s  .c  o  m*/
protected void renderDragonModel(EntityDragonBoss par1EntityDragonBoss, float par2, float par3, float par4,
        float par5, float par6, float par7) {
    if (par1EntityDragonBoss.deathTicks > 0) {
        float f6 = par1EntityDragonBoss.deathTicks / 200.0F;
        GL11.glDepthFunc(GL11.GL_LEQUAL);
        GL11.glEnable(GL11.GL_ALPHA_TEST);
        GL11.glAlphaFunc(GL11.GL_GREATER, f6);
        bindTexture(field_110842_f);
        mainModel.render(par1EntityDragonBoss, par2, par3, par4, par5, par6, par7);
        GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F);
        GL11.glDepthFunc(GL11.GL_EQUAL);
    }

    bindEntityTexture(par1EntityDragonBoss);
    mainModel.render(par1EntityDragonBoss, par2, par3, par4, par5, par6, par7);

    if (par1EntityDragonBoss.hurtTime > 0) {
        GL11.glDepthFunc(GL11.GL_EQUAL);
        GL11.glDisable(GL11.GL_TEXTURE_2D);
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
        GL11.glColor4f(1.0F, 0.0F, 0.0F, 0.5F);
        mainModel.render(par1EntityDragonBoss, par2, par3, par4, par5, par6, par7);
        GL11.glEnable(GL11.GL_TEXTURE_2D);
        GL11.glDisable(GL11.GL_BLEND);
        GL11.glDepthFunc(GL11.GL_LEQUAL);
    }
}

From source file:com.shinoow.abyssalcraft.client.render.entity.RenderDragonBoss.java

License:Apache License

/**
 * Renders the overlay for glowing eyes and the mouth. Called by shouldRenderPass.
 *///from   w w w.j ava 2 s . c  o m
protected int renderGlow(EntityDragonBoss par1entitydragonboss, int par2, float par3) {
    if (par2 == 1)
        GL11.glDepthFunc(GL11.GL_LEQUAL);

    if (par2 != 0)
        return -1;
    else {
        bindTexture(field_110845_h);
        float f1 = 1.0F;
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glDisable(GL11.GL_ALPHA_TEST);
        GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE);
        GL11.glDisable(GL11.GL_LIGHTING);
        GL11.glDepthFunc(GL11.GL_EQUAL);
        char c0 = 61680;
        int j = c0 % 65536;
        int k = c0 / 65536;
        OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, j / 1.0F, k / 1.0F);
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        GL11.glEnable(GL11.GL_LIGHTING);
        GL11.glColor4f(1.0F, 1.0F, 1.0F, f1);
        return 1;
    }
}

From source file:com.shinoow.abyssalcraft.client.render.entity.RenderDragonMinion.java

License:Apache License

/**
 * Renders the dragon model. Called by renderModel.
 *//*from  w  w w .j a  v a2 s.c  o m*/
protected void renderDragonModel(EntityDragonMinion par1EntityDragonMinion, float par2, float par3, float par4,
        float par5, float par6, float par7) {
    bindEntityTexture(par1EntityDragonMinion);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    mainModel.render(par1EntityDragonMinion, par2, par3, par4, par5, par6, par7);
    GL11.glDisable(GL11.GL_BLEND);

    if (par1EntityDragonMinion.hurtTime > 0) {
        GL11.glDepthFunc(GL11.GL_EQUAL);
        GL11.glDisable(GL11.GL_TEXTURE_2D);
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
        GL11.glColor4f(1.0F, 0.0F, 0.0F, 0.5F);
        mainModel.render(par1EntityDragonMinion, par2, par3, par4, par5, par6, par7);
        GL11.glEnable(GL11.GL_TEXTURE_2D);
        GL11.glDisable(GL11.GL_BLEND);
        GL11.glDepthFunc(GL11.GL_LEQUAL);
    }
}

From source file:com.shinoow.abyssalcraft.client.render.entity.RenderDragonMinion.java

License:Apache License

/**
 * Renders the overlay for glowing eyes and the mouth. Called by shouldRenderPass.
 *//*w  w  w .  j av a  2  s.c om*/
protected int renderGlow(EntityDragonMinion par1EntityDragonMinion, int par2, float par3) {
    if (par2 == 1)
        GL11.glDepthFunc(GL11.GL_LEQUAL);

    if (par2 != 0)
        return -1;
    else {
        bindTexture(field_110845_h);
        float f1 = 1.0F;
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glDisable(GL11.GL_ALPHA_TEST);
        GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE);
        GL11.glDisable(GL11.GL_LIGHTING);
        GL11.glDepthFunc(GL11.GL_EQUAL);
        char c0 = 61680;
        int j = c0 % 65536;
        int k = c0 / 65536;
        OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, j / 1.0F, k / 1.0F);
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        GL11.glEnable(GL11.GL_LIGHTING);
        GL11.glColor4f(1.0F, 1.0F, 1.0F, f1);
        return 1;
    }
}

From source file:com.spawck.hs2.client.renderer.model.ModelSoul.java

License:GNU General Public License

@Override
public void render(Entity entity, float par2, float par3, float par4, float par5, float par6, float par7) {
    GL11.glPushMatrix();//from w w w .  j  a va 2 s  . co  m
    GL11.glScalef(1.0F, 1.0F, 1.0F);
    GL11.glTranslatef(0.0F, -0.5F, 0.0F);

    if (this.base != null) {
        this.base.render(par7);
    }

    GL11.glEnable(2977);
    GL11.glEnable(3042);
    GL11.glBlendFunc(770, 771);
    GL11.glRotatef(par3, 0.0F, 1.0F, 0.0F);
    GL11.glTranslatef(0.0F, 0.8F + par4, 0.0F);
    GL11.glRotatef(60.0F, 0.7071F, 0.0F, 0.7071F);
    this.glass.render(par7);
    float var8 = 0.875F;
    GL11.glScalef(var8, var8, var8);
    GL11.glRotatef(60.0F, 0.7071F, 0.0F, 0.7071F);
    GL11.glRotatef(par3, 0.0F, 1.0F, 0.0F);
    this.glass.render(par7);
    GL11.glScalef(var8, var8, var8);
    GL11.glRotatef(60.0F, 0.7071F, 0.0F, 0.7071F);
    GL11.glRotatef(par3, 0.0F, 1.0F, 0.0F);
    this.cube.render(par7);
    GL11.glDepthFunc(514);
    GL11.glDisable(2896);
    GL11.glEnable(3042);
    GL11.glBlendFunc(768, 1);
    float var14 = 0.76F;
    GL11.glColor4f(0.5F * var14, 0.25F * var14, 0.8F * var14, 1.0F);
    GL11.glMatrixMode(5890);
    GL11.glPushMatrix();
    float var15 = 0.125F;
    GL11.glScalef(var15, var15, var15);
    float var16 = (float) (Minecraft.getSystemTime() % 3000L) / 3000.0F * 8.0F;
    GL11.glTranslatef(var16, 0.0F, 0.0F);
    GL11.glRotatef(-50.0F, 0.0F, 0.0F, 1.0F);
    this.cube.render(par7);
    GL11.glPopMatrix();
    GL11.glPushMatrix();
    GL11.glScalef(var15, var15, var15);
    var16 = (float) (Minecraft.getSystemTime() % 4873L) / 4873.0F * 8.0F;
    GL11.glTranslatef(-var16, 0.0F, 0.0F);
    GL11.glRotatef(10.0F, 0.0F, 0.0F, 1.0F);
    this.cube.render(par7);
    GL11.glPopMatrix();
    GL11.glMatrixMode(5888);
    GL11.glDisable(3042);
    GL11.glEnable(2896);
    GL11.glDepthFunc(515);
    GL11.glPopMatrix();
}

From source file:com.sriramramani.droid.inspector.ui.InspectorCanvas.java

License:Mozilla Public License

public InspectorCanvas(Composite parent, int style, GLData data) {
    super(parent, style, data);
    setCurrent();/*  w  w w .jav  a  2  s  . co  m*/

    // Clear the canvas.
    GL11.glClearColor(CLEAR_COLOR[0], CLEAR_COLOR[1], CLEAR_COLOR[2], CLEAR_COLOR[3]);
    GL11.glClearDepth(1.0f);
    GL11.glLineWidth(1.0f);
    GL11.glPointSize(1.0f);

    GL11.glShadeModel(GL11.GL_FLAT);

    GL11.glEnable(GL11.GL_LINE_SMOOTH);
    GL11.glHint(GL11.GL_LINE_SMOOTH_HINT, GL11.GL_NICEST);

    GL11.glEnable(GL11.GL_POLYGON_SMOOTH);
    GL11.glHint(GL11.GL_POLYGON_SMOOTH_HINT, GL11.GL_NICEST);

    GL11.glHint(GL11.GL_PERSPECTIVE_CORRECTION_HINT, GL11.GL_NICEST);

    GL11.glDisable(GL11.GL_LIGHTING);

    GL11.glEnable(GL11.GL_DEPTH_TEST);
    GL11.glDepthMask(true);
    GL11.glDepthFunc(GL11.GL_LEQUAL);

    GL11.glEnable(GL11.GL_ALPHA_TEST);
    GL11.glAlphaFunc(GL11.GL_GREATER, 0.01f);

    GL11.glEnable(GL11.GL_STENCIL_TEST);
    GL11.glStencilFunc(GL11.GL_ALWAYS, 0x1, 0xf);
    GL11.glStencilOp(GL11.GL_INCR, GL11.GL_KEEP, GL11.GL_INCR);

    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

    reset();

    mTransform = new Matrix4f();
    mTransform.setIdentity();

    addListener(SWT.Resize, this);
    addListener(SWT.Paint, this);
    addMouseListener(this);
    addMouseWheelListener(this);
}

From source file:cuchaz.jfxgl.prism.JFXGLContext.java

License:Open Source License

@Override
public void updateViewportAndDepthTest(int x, int y, int w, int h, boolean depthTest) {

    GL11.glViewport(x, y, w, h);//  ww  w .j a  v a  2 s. co m

    if (depthTest) {
        GL11.glEnable(GL11.GL_DEPTH_TEST);
        GL11.glDepthFunc(GL11.GL_LEQUAL);
        GL11.glDepthMask(true);
    } else {
        GL11.glDisable(GL11.GL_DEPTH_TEST);
        GL11.glDepthMask(false);
    }
}

From source file:de.ikosa.mars.viewer.glviewer.engine.GLRenderer2Stage.java

License:Open Source License

public static void clientSetup() {
    // setup opengl
    GL11.glEnable(GL11.GL_DEPTH_TEST);//from  www  .  ja  v a2 s.  com
    errorCheck("setting up client state GL_DEPTH_TEST");

    GL11.glDepthFunc(GL11.GL_LEQUAL);
    errorCheck("setting depth test function");

    // GL11.glEnable(GL11.GL_CULL_FACE);
    errorCheck("enabling back face culling");
}